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
52623f11
Commit
52623f11
authored
Oct 12, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for silent, group, groupSummary flags on Android
parent
d9bb523c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
LocalNotification.java
src/android/LocalNotification.java
+1
-1
Builder.java
src/android/notification/Builder.java
+8
-1
Options.java
src/android/notification/Options.java
+21
-1
local-notification-util.js
www/local-notification-util.js
+3
-0
No files found.
src/android/LocalNotification.java
View file @
52623f11
...
...
@@ -638,7 +638,7 @@ public class LocalNotification extends CordovaPlugin {
*
* @return "background" or "foreground"
*/
static
String
getApplicationState
()
{
static
String
getApplicationState
()
{
return
isInBackground
?
"background"
:
"foreground"
;
}
...
...
src/android/notification/Builder.java
View file @
52623f11
...
...
@@ -90,10 +90,15 @@ public class Builder {
int
smallIcon
=
options
.
getSmallIcon
();
NotificationCompat
.
Builder
builder
;
builder
=
new
NotificationCompat
.
Builder
(
context
,
"group"
)
if
(
options
.
isSilent
())
{
return
new
Notification
(
context
,
options
);
}
builder
=
new
NotificationCompat
.
Builder
(
context
,
"channel"
)
.
setDefaults
(
options
.
getDefaults
())
.
setContentTitle
(
options
.
getTitle
())
.
setContentText
(
options
.
getText
())
.
setTicker
(
options
.
getText
())
.
setNumber
(
options
.
getBadgeNumber
())
.
setAutoCancel
(
options
.
isAutoClear
())
.
setOngoing
(
options
.
isSticky
())
...
...
@@ -103,6 +108,8 @@ public class Builder {
.
setPriority
(
options
.
getPriority
())
.
setShowWhen
(
options
.
getShowWhen
())
.
setUsesChronometer
(
options
.
isWithProgressBar
())
.
setGroup
(
options
.
getGroup
())
.
setGroupSummary
(
options
.
getGroupSummary
())
.
setLights
(
options
.
getLedColor
(),
options
.
getLedOn
(),
options
.
getLedOff
());
if
(
options
.
isWithProgressBar
())
{
...
...
src/android/notification/Options.java
View file @
52623f11
...
...
@@ -30,7 +30,6 @@ import org.json.JSONArray;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -488,6 +487,27 @@ public class Options {
}
/**
* The group for that notification.
*/
String
getGroup
()
{
return
options
.
optString
(
"group"
,
null
);
}
/**
* If the group shall show a summary.
*/
boolean
getGroupSummary
()
{
return
options
.
optBoolean
(
"groupSummary"
,
false
);
}
/**
* Gets the value of the silent flag.
*/
boolean
isSilent
()
{
return
options
.
optBoolean
(
"silent"
,
false
);
}
/**
* Gets the raw trigger spec as provided by the user.
*/
public
JSONObject
getTrigger
()
{
...
...
www/local-notification-util.js
View file @
52623f11
...
...
@@ -31,6 +31,7 @@ exports._defaults = {
badge
:
undefined
,
data
:
undefined
,
icon
:
undefined
,
silent
:
false
,
trigger
:
{
type
:
'calendar'
},
actions
:
[],
actionGroupId
:
undefined
,
...
...
@@ -51,6 +52,8 @@ exports.applyPlatformSpecificOptions = function () {
switch
(
device
.
platform
)
{
case
'Android'
:
defaults
.
group
=
undefined
;
defaults
.
groupSummary
=
false
;
defaults
.
summary
=
undefined
;
defaults
.
icon
=
'res://icon'
;
defaults
.
smallIcon
=
undefined
;
...
...
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