NotificationCompat.Builder b=new NotificationCompat.Builder(this);
b.setSmallIcon(R.drawable.ic_launcher);
b.setContentTitle("My Notification");
b.setContentText("click here to navigate Activity2");
Date d=new Date();
long i=(long)d.getTime();
Intent notificationIntent=new Intent(this,Activity2.class);
PendingIntent pintent=PendingIntent.getActivity(this,0,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
b.setContentIntent(pintent);
NotificationManager nManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
nManager.notify((int)i,b.build());
Sunday, 4 December 2016
How to show notification with navigation to another Activity in android?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment