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
b8da398a
Commit
b8da398a
authored
Dec 27, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If the app is not running, the callback has to be called later (#42)
parent
05e1e72e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
README.md
README.md
+1
-0
ReceiverActivity.java
src/android/ReceiverActivity.java
+18
-3
No files found.
README.md
View file @
b8da398a
...
...
@@ -55,6 +55,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/331).
-
[
enhancement:
]
Added 'hourly' as a new repeat time aliase.
-
[
feature:
]
Repeat with custom intervals on Android.
-
**[bugfix:]**
Callbacks are called with the ID as a number and not as a string.
-
[
enhancement:
]
The background callback on Android is called, even the app is not running when the notification is tapped.
#### Version 0.6.3 (12.12.2013)
-
[
bugfix:
]
Black screen on Android.
...
...
src/android/ReceiverActivity.java
View file @
b8da398a
...
...
@@ -21,6 +21,9 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -73,10 +76,22 @@ public class ReceiverActivity extends Activity {
private
void
invokeBackgroundCallback
(
Options
options
)
{
String
function
=
options
.
getBackground
();
if
(
TextUtils
.
isEmpty
(
function
))
return
;
final
String
js
=
"setTimeout('"
+
function
+
"(\""
+
options
.
getId
()
+
"\")',0)"
;
// after reboot, LocalNotification.webView is always null
// may be call background callback later
if
(!
TextUtils
.
isEmpty
(
function
)
&&
LocalNotification
.
webView
!=
null
)
{
LocalNotification
.
webView
.
sendJavascript
(
"setTimeout('"
+
function
+
"(\""
+
options
.
getId
()
+
"\")',0)"
);
// call background callback later
if
(
LocalNotification
.
webView
==
null
)
{
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
LocalNotification
.
webView
.
sendJavascript
(
js
);
}
},
4000
);
}
else
{
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