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
98d4d59f
Commit
98d4d59f
authored
Sep 07, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sound wird nur abgespielt, wenn die App im Hintergrund läuft
parent
0d039d2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
LocalNotificationReceiver.java
src/android/LocalNotificationReceiver.java
+11
-4
No files found.
src/android/LocalNotificationReceiver.java
View file @
98d4d59f
...
...
@@ -15,6 +15,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
android.annotation.TargetApi
;
import
android.app.ActivityManager
;
import
android.app.Notification
;
import
android.app.Notification.Builder
;
import
android.app.NotificationManager
;
...
...
@@ -62,8 +63,10 @@ public class LocalNotificationReceiver extends BroadcastReceiver {
*/
if
(
options
.
getInterval
()
>
0
)
{
Calendar
now
=
Calendar
.
getInstance
();
int
alarmHour
=
0
;
//bundle.getInt(HOUR_OF_DAY);
int
alarmMin
=
0
;
//bundle.getInt(MINUTE);
Calendar
alarm
=
options
.
getCalendar
();
int
alarmHour
=
alarm
.
get
(
Calendar
.
HOUR_OF_DAY
);
int
alarmMin
=
alarm
.
get
(
Calendar
.
MINUTE
);
int
currentHour
=
now
.
get
(
Calendar
.
HOUR_OF_DAY
);
int
currentMin
=
now
.
get
(
Calendar
.
MINUTE
);
...
...
@@ -79,12 +82,16 @@ public class LocalNotificationReceiver extends BroadcastReceiver {
Builder
notification
=
new
Notification
.
Builder
(
context
)
.
setContentTitle
(
options
.
getTitle
())
.
setContentText
(
options
.
getSubTitle
())
//.setVibrate(new long[] { 0, 100, 200, 300 })
.
setDefaults
(
Notification
.
DEFAULT_SOUND
)
.
setNumber
(
options
.
getBadge
())
.
setContentIntent
(
contentIntent
)
.
setTicker
(
options
.
getTitle
())
.
setSmallIcon
(
options
.
getIcon
());
if
(!
context
.
getPackageName
().
equalsIgnoreCase
(((
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)).
getRunningTasks
(
1
).
get
(
0
).
topActivity
.
getPackageName
()))
{
// app is in background
notification
.
setDefaults
(
Notification
.
DEFAULT_SOUND
);
}
/*
* If you want all reminders to stay in the notification bar, you should
* generate a random ID. If you want do replace an existing
...
...
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