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
235c49ee
Commit
235c49ee
authored
Dec 19, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repeat with shorter/curstom intervals (#27)
parent
10c6988c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
README.md
README.md
+11
-8
Options.java
src/android/Options.java
+5
-1
APPLocalNotification.m
src/ios/APPLocalNotification.m
+4
-3
No files found.
README.md
View file @
235c49ee
...
@@ -50,8 +50,10 @@ More informations can be found [here](https://build.phonegap.com/plugins/331).
...
@@ -50,8 +50,10 @@ More informations can be found [here](https://build.phonegap.com/plugins/331).
-
[
bugfix:
]
App throws an error on iOS if
`message`
is null.
-
[
bugfix:
]
App throws an error on iOS if
`message`
is null.
-
[
bugfix:
]
Removed extra line break on iOS if
`title`
is null or empty.
-
[
bugfix:
]
Removed extra line break on iOS if
`title`
is null or empty.
-
[
bugfix:
]
Notification on iOS will be canceled if a new one with the same ID was added.
-
[
bugfix:
]
Notification on iOS will be canceled if a new one with the same ID was added.
-
[
enhancement
:
]
Added
`autoCancel`
flag.
-
[
feature
:
]
Added
`autoCancel`
flag.
-
[
bugfix:
]
`cancel`
on iOS did not work.
-
[
bugfix:
]
`cancel`
on iOS did not work.
-
[
enhancement:
]
Added 'hourly' as a new repeat time aliase.
-
[
feature:
]
Repeat with custom intervals on Android.
#### Version 0.6.3 (12.12.2013)
#### Version 0.6.3 (12.12.2013)
-
[
bugfix:
]
Black screen on Android.
-
[
bugfix:
]
Black screen on Android.
...
@@ -105,7 +107,7 @@ window.plugin.notification.local.add({
...
@@ -105,7 +107,7 @@ window.plugin.notification.local.add({
date
:
Date
,
// This expects a date object
date
:
Date
,
// This expects a date object
message
:
String
,
// The message that is displayed
message
:
String
,
// The message that is displayed
title
:
String
,
// The title of the message
title
:
String
,
// The title of the message
repeat
:
String
,
// Has the options of
daily', 'weekly',''monthly','yearly')
repeat
:
String
,
// Has the options of
'hourly', 'daily', 'weekly', 'monthly', 'yearly'
badge
:
Number
,
// Displays number badge to notification
badge
:
Number
,
// Displays number badge to notification
sound
:
String
,
// A sound to be played (iOS & Android)
sound
:
String
,
// A sound to be played (iOS & Android)
autoCancel
:
Boolean
,
// Setting this flag and the notification is automatically canceled when the user clicks it
autoCancel
:
Boolean
,
// Setting this flag and the notification is automatically canceled when the user clicks it
...
@@ -160,12 +162,6 @@ window.plugin.notification.local.add({ message: 'Great app!' });
...
@@ -160,12 +162,6 @@ window.plugin.notification.local.add({ message: 'Great app!' });
```
javascript
```
javascript
window
.
plugin
.
notification
.
local
.
add
({
sound
:
null
});
window
.
plugin
.
notification
.
local
.
add
({
sound
:
null
});
```
```
#### Cancel notification immediatly after creation
```
javascript
window
.
plugin
.
notification
.
local
.
add
({
id
:
1
,
message
:
'Reminder'
});
// `add` is executed asynchron!
setTimeout
(
'plugin.notification.local.cancel(1)'
,
200
);
```
## Platform specifics
## Platform specifics
...
@@ -218,6 +214,13 @@ An image must be defined as a relative or absolute URI.
...
@@ -218,6 +214,13 @@ An image must be defined as a relative or absolute URI.
window
.
plugin
.
notification
.
local
.
add
({
image
:
'appdata:ApplicationIcon.png'
})
window
.
plugin
.
notification
.
local
.
add
({
image
:
'appdata:ApplicationIcon.png'
})
```
```
All images can be restored to the default ones by canceling the notification.
All images can be restored to the default ones by canceling the notification.
### Custom repeating interval on Android
To specify a custom interval, the
`repeat`
property can be assigned with an number in minutes.
```
/**
* Schedules the notification quarterly every 15 mins
*/
window.plugin.notification.local.add({ repeat: 15 });
## Quirks
## Quirks
...
...
src/android/Options.java
View file @
235c49ee
...
@@ -57,7 +57,9 @@ public class Options {
...
@@ -57,7 +57,9 @@ public class Options {
this
.
options
=
options
;
this
.
options
=
options
;
if
(
repeat
.
equalsIgnoreCase
(
"daily"
))
{
if
(
repeat
.
equalsIgnoreCase
(
"hourly"
))
{
interval
=
AlarmManager
.
INTERVAL_HOUR
;
}
if
(
repeat
.
equalsIgnoreCase
(
"daily"
))
{
interval
=
AlarmManager
.
INTERVAL_DAY
;
interval
=
AlarmManager
.
INTERVAL_DAY
;
}
else
if
(
repeat
.
equalsIgnoreCase
(
"weekly"
))
{
}
else
if
(
repeat
.
equalsIgnoreCase
(
"weekly"
))
{
interval
=
AlarmManager
.
INTERVAL_DAY
*
7
;
interval
=
AlarmManager
.
INTERVAL_DAY
*
7
;
...
@@ -65,6 +67,8 @@ public class Options {
...
@@ -65,6 +67,8 @@ public class Options {
interval
=
AlarmManager
.
INTERVAL_DAY
*
31
;
// 31 days
interval
=
AlarmManager
.
INTERVAL_DAY
*
31
;
// 31 days
}
else
if
(
repeat
.
equalsIgnoreCase
(
"yearly"
))
{
}
else
if
(
repeat
.
equalsIgnoreCase
(
"yearly"
))
{
interval
=
AlarmManager
.
INTERVAL_DAY
*
365
;
interval
=
AlarmManager
.
INTERVAL_DAY
*
365
;
}
else
{
interval
=
Integer
.
getInteger
(
repeat
,
0
)
*
60000
;
}
}
return
this
;
return
this
;
...
...
src/ios/APPLocalNotification.m
View file @
235c49ee
...
@@ -148,10 +148,11 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
...
@@ -148,10 +148,11 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
{
{
NSMutableDictionary
*
repeatDict
=
[[
NSMutableDictionary
alloc
]
init
];
NSMutableDictionary
*
repeatDict
=
[[
NSMutableDictionary
alloc
]
init
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NSDayCalendarUnit
]
forKey
:
@"daily"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NSCalendarUnitHour
]
forKey
:
@"hourly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NSCalendarUnitDay
]
forKey
:
@"daily"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NSWeekCalendarUnit
]
forKey
:
@"weekly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NSWeekCalendarUnit
]
forKey
:
@"weekly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NS
MonthCalendarUnit
]
forKey
:
@"monthly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NS
CalendarUnitMonth
]
forKey
:
@"monthly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NS
YearCalendarUnit
]
forKey
:
@"yearly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
NS
CalendarUnitYear
]
forKey
:
@"yearly"
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
0
]
forKey
:
@""
];
[
repeatDict
setObject
:[
NSNumber
numberWithInt
:
0
]
forKey
:
@""
];
return
repeatDict
;
return
repeatDict
;
...
...
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