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
4f9f3d06
Commit
4f9f3d06
authored
Dec 13, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made small icon on Android optional
parent
34110162
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
8 deletions
+28
-8
CHANGELOG.md
CHANGELOG.md
+1
-0
Builder.java
src/android/notification/Builder.java
+8
-2
Options.java
src/android/notification/Options.java
+17
-4
local-notification-util.js
www/local-notification-util.js
+2
-2
No files found.
CHANGELOG.md
View file @
4f9f3d06
...
...
@@ -5,6 +5,7 @@ Please also read the [Upgrade Guide](https://github.com/katzer/cordova-plugin-lo
#### Version 0.8.3 (not yet released)
-
New "quarter" intervall for iOS & Android
-
Made small icon optional (Android)
-
Fixed #588 crash when basename & extension can't be extracted (Android)
-
Fixed #732 loop between update and trigger (Android)
-
Fixed #710 crash due to >500 notifications (Android)
...
...
src/android/notification/Builder.java
View file @
4f9f3d06
...
...
@@ -116,6 +116,7 @@ public class Builder {
*/
public
Notification
build
()
{
Uri
sound
=
options
.
getSoundUri
();
int
smallIcon
=
options
.
getSmallIcon
();
NotificationCompat
.
Builder
builder
;
builder
=
new
NotificationCompat
.
Builder
(
context
)
...
...
@@ -124,8 +125,6 @@ public class Builder {
.
setContentText
(
options
.
getText
())
.
setNumber
(
options
.
getBadgeNumber
())
.
setTicker
(
options
.
getText
())
.
setSmallIcon
(
options
.
getSmallIcon
())
.
setLargeIcon
(
options
.
getIconBitmap
())
.
setAutoCancel
(
options
.
isAutoClear
())
.
setOngoing
(
options
.
isOngoing
())
.
setLights
(
options
.
getLedColor
(),
500
,
500
);
...
...
@@ -134,6 +133,13 @@ public class Builder {
builder
.
setSound
(
sound
);
}
if
(
smallIcon
==
0
)
{
builder
.
setSmallIcon
(
options
.
getIcon
());
}
else
{
builder
.
setSmallIcon
(
options
.
getSmallIcon
());
builder
.
setLargeIcon
(
options
.
getIconBitmap
());
}
applyDeleteReceiver
(
builder
);
applyContentReceiver
(
builder
);
...
...
src/android/notification/Options.java
View file @
4f9f3d06
...
...
@@ -282,21 +282,34 @@ public class Options {
}
/**
*
Small i
con resource ID for the local notification.
*
I
con resource ID for the local notification.
*/
public
int
get
Small
Icon
()
{
String
icon
=
options
.
optString
(
"
smallI
con"
,
""
);
public
int
getIcon
()
{
String
icon
=
options
.
optString
(
"
i
con"
,
""
);
int
resId
=
assets
.
getResIdForDrawable
(
icon
);
if
(
resId
==
0
)
{
resId
=
android
.
R
.
drawable
.
screen_background_dark
;
resId
=
getSmallIcon
();
}
if
(
resId
==
0
)
{
resId
=
android
.
R
.
drawable
.
ic_popup_reminder
;
}
return
resId
;
}
/**
* Small icon resource ID for the local notification.
*/
public
int
getSmallIcon
()
{
String
icon
=
options
.
optString
(
"smallIcon"
,
""
);
return
assets
.
getResIdForDrawable
(
icon
);
}
/**
* JSON object as string.
*/
public
String
toString
()
{
...
...
www/local-notification-util.js
View file @
4f9f3d06
...
...
@@ -60,8 +60,8 @@ exports.applyPlatformSpecificOptions = function () {
switch
(
device
.
platform
)
{
case
'Android'
:
defaults
.
icon
=
'res://ic
on
'
;
defaults
.
smallIcon
=
'res://ic_popup_reminder'
;
defaults
.
icon
=
'res://ic
_popup_reminder
'
;
defaults
.
smallIcon
=
undefined
;
defaults
.
ongoing
=
false
;
defaults
.
autoClear
=
true
;
defaults
.
led
=
'FFFFFF'
;
...
...
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