hi how to handle push notification click i need to open activity with specific fragment , i have two states like app is closed and app is opened , when the app is closed i need to open home activity with MyFragment.class , if app is opned then i need to show dialog u need to see details if yes i need to open specific fragment like MyFragment, if no i need to dissmis dialog, ,, how to implemnet it...
@SuppressWarnings("deprecation")
@Override
public void update(java.util.Observable observable, Object data) {
NotificationManager notificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.ic_launcher,
data.toString(), when);
String title = this.getString(R.string.app_name);
Intent notificationIntent = new Intent(this, MainActivity.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(this, title, data.toString(), intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
// Play default notification sound
notification.defaults |= Notification.DEFAULT_SOUND;
// Vibrate if vibrate is enabled
notification.defaults |= Notification.DEFAULT_VIBRATE;
notificationManager.notify(0, notification);
Log.d("GCM_TOKEN", data.toString());
Toast.makeText(this, "Error: " + data.toString(), Toast.LENGTH_LONG)
.show();
}
thanks