Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
421b2df5
Commit
421b2df5
authored
Jan 11, 2014
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed hard coded 4s pause. Callbacks are called after the webview was initialized.
parent
663037ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
LocalNotification.java
src/android/LocalNotification.java
+19
-3
ReceiverActivity.java
src/android/ReceiverActivity.java
+1
-9
No files found.
src/android/LocalNotification.java
View file @
421b2df5
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
java.util.ArrayList
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -48,10 +49,12 @@ import android.content.SharedPreferences.Editor;
...
@@ -48,10 +49,12 @@ import android.content.SharedPreferences.Editor;
*/
*/
public
class
LocalNotification
extends
CordovaPlugin
{
public
class
LocalNotification
extends
CordovaPlugin
{
protected
final
static
String
PLUGIN_NAME
=
"LocalNotification"
;
protected
final
static
String
PLUGIN_NAME
=
"LocalNotification"
;
protected
static
CordovaWebView
webView
=
null
;
protected
static
CordovaWebView
webView
=
null
;
protected
static
Context
context
=
null
;
protected
static
Context
context
=
null
;
protected
static
ArrayList
<
String
>
callbackQueue
=
new
ArrayList
<
String
>();
@Override
@Override
public
void
initialize
(
CordovaInterface
cordova
,
CordovaWebView
webView
)
{
public
void
initialize
(
CordovaInterface
cordova
,
CordovaWebView
webView
)
{
...
@@ -59,6 +62,8 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -59,6 +62,8 @@ public class LocalNotification extends CordovaPlugin {
LocalNotification
.
webView
=
super
.
webView
;
LocalNotification
.
webView
=
super
.
webView
;
LocalNotification
.
context
=
super
.
cordova
.
getActivity
().
getApplicationContext
();
LocalNotification
.
context
=
super
.
cordova
.
getActivity
().
getApplicationContext
();
execPendingCallbacks
();
}
}
@Override
@Override
...
@@ -240,4 +245,15 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -240,4 +245,15 @@ public class LocalNotification extends CordovaPlugin {
protected
static
NotificationManager
getNotificationManager
()
{
protected
static
NotificationManager
getNotificationManager
()
{
return
(
NotificationManager
)
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
return
(
NotificationManager
)
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
}
}
/**
* Calls all pending callbacks after the webview was created.
*/
private
void
execPendingCallbacks
()
{
for
(
String
js
:
callbackQueue
)
{
webView
.
sendJavascript
(
js
);
}
callbackQueue
.
clear
();
}
}
}
src/android/ReceiverActivity.java
View file @
421b2df5
...
@@ -21,9 +21,6 @@
...
@@ -21,9 +21,6 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
...
@@ -80,12 +77,7 @@ public class ReceiverActivity extends Activity {
...
@@ -80,12 +77,7 @@ public class ReceiverActivity extends Activity {
// after reboot, LocalNotification.webView is always null
// after reboot, LocalNotification.webView is always null
// call background callback later
// call background callback later
if
(
LocalNotification
.
webView
==
null
)
{
if
(
LocalNotification
.
webView
==
null
)
{
new
Timer
().
schedule
(
new
TimerTask
()
{
LocalNotification
.
callbackQueue
.
add
(
js
);
@Override
public
void
run
()
{
LocalNotification
.
webView
.
sendJavascript
(
js
);
}
},
4000
);
}
else
{
}
else
{
LocalNotification
.
webView
.
sendJavascript
(
js
);
LocalNotification
.
webView
.
sendJavascript
(
js
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment