Created
May 28, 2017 19:01
-
-
Save akbarsha03/19948895c4db1945636396c51fd701fe to your computer and use it in GitHub Desktop.
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
// object 1 | |
NotificationCompat.Builder mBuilder = | |
new NotificationCompat.Builder(this) | |
.setSmallIcon(R.drawable.notification_icon) | |
.setContentTitle("My notification") | |
.setContentText("Hello World!"); | |
// object 2 | |
Intent resultIntent = new Intent(this, ResultActivity.class); | |
// object 3 | |
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); | |
stackBuilder.addParentStack(ResultActivity.class); | |
stackBuilder.addNextIntent(resultIntent); | |
// object 4 | |
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 0, PendingIntent.FLAG_UPDATE_CURRENT); | |
mBuilder.setContentIntent(resultPendingIntent); | |
// object 5 | |
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | |
mNotificationManager.notify(mId, mBuilder.build()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment