android - Reopen PendingIntent after AppDestroy -
i have problem pendingintent in app.
i send gcm messages server application. when user clicks on notification, new pendingintent created moves user "alertactivity", countdown starts
all of works fine @ moment.
the problem now, when user closes app , reopen it. while countdown running want redirect user alertactivity again.
how possible?
i start intent with:
private void sendnotification(string msg) { intent resultintent = new intent(this, alertactivity.class); resultintent.putextra("msg", msg); pendingintent resultpendingintent = pendingintent.getactivity(this, 0, resultintent, 0); notificationcompat.builder mnotifybuilder; notificationmanager mnotificationmanager; mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); mnotifybuilder = new notificationcompat.builder(this) .setcontenttitle("alert") .setcontenttext("you've received new message.") .setsmallicon(r.drawable.ic_launcher); // set pending intent mnotifybuilder.setcontentintent(resultpendingintent); // set vibrate, sound , light int defaults = 0; //defaults = defaults | notification.default_lights; //defaults = defaults | notification.default_vibrate; // defaults = defaults | notification.default_sound; notification notification = mnotifybuilder.build(); notification.flags |= notification.flag_auto_cancel; notification.sound = uri.parse("android.resource://" + getpackagename() + "/" + r.raw.alarm); notification.defaults |= notification.default_vibrate; mnotifybuilder.setdefaults(defaults); // set content notification mnotifybuilder.setcontenttext("new message server"); // set autocancel mnotifybuilder.setautocancel(true); // post notification mnotificationmanager.notify(notifyid, notification); }
Comments
Post a Comment