Created
October 15, 2014 12:58
-
-
Save louisbl/846a4b3b10b76b1e6e90 to your computer and use it in GitHub Desktop.
Android notification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Notifications | |
Intent resultIntent = new Intent(this, PlayListActivity.class); | |
PendingIntent resultPendingIntent = | |
PendingIntent.getActivity(this, | |
0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT | |
); | |
NotificationCompat.Builder notifBuilder = | |
new NotificationCompat.Builder(this) | |
.setSmallIcon(android.R.drawable.ic_dialog_alert) | |
.setContentIntent(resultPendingIntent) | |
.setAutoCancel(true) | |
.setContentTitle("A notification!") | |
.setContentText("Notifcation content"); | |
int mNotificationId = 12; | |
NotificationManager mNotifyMgr = | |
(NotificationManager) getSystemService(NOTIFICATION_SERVICE); | |
mNotifyMgr.notify(mNotificationId, notifBuilder.build()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment