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
8f8caabc
Commit
8f8caabc
authored
Sep 06, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Klick auf die Notification bringt die App in den Vordergrund
parent
331227c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
LocalNotificationReceiver.java
src/android/LocalNotificationReceiver.java
+11
-3
No files found.
src/android/LocalNotificationReceiver.java
View file @
8f8caabc
...
...
@@ -14,10 +14,10 @@ import java.util.Calendar;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
android.R
;
import
android.annotation.TargetApi
;
import
android.app.Notification
;
import
android.app.Notification.Builder
;
import
android.app.Activity
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.content.BroadcastReceiver
;
...
...
@@ -26,6 +26,10 @@ import android.content.Intent;
import
android.os.Build
;
import
android.os.Bundle
;
class
MyActivity
extends
Activity
{
}
/**
* The alarm receiver is triggered when a scheduled alarm is fired. This class
* reads the information in the intent and displays this information in the
...
...
@@ -69,17 +73,21 @@ public class LocalNotificationReceiver extends BroadcastReceiver {
int
currentMin
=
now
.
get
(
Calendar
.
MINUTE
);
if
(
currentHour
!=
alarmHour
&&
currentMin
!=
alarmMin
)
{
return
;
}
}
String
packageName
=
context
.
getPackageName
();
Intent
launchIntent
=
context
.
getPackageManager
().
getLaunchIntentForPackage
(
packageName
);
PendingIntent
contentIntent
=
PendingIntent
.
getActivity
(
context
,
0
,
launchIntent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
Builder
notification
=
new
Notification
.
Builder
(
context
)
.
setContentTitle
(
options
.
getTitle
())
.
setContentText
(
options
.
getSubTitle
())
//.setVibrate(new long[] { 0, 100, 200, 300 })
.
setDefaults
(
Notification
.
DEFAULT_SOUND
)
.
setNumber
(
0
)
.
setNumber
(
options
.
getBadge
())
.
setContentIntent
(
contentIntent
)
.
setSmallIcon
(
options
.
getIcon
());
/*
...
...
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