android - Pending Intent extras are missing when receive -
i have problem sending extras pending intent. i'm adding string in statech
service , sending mainactivity
. mainactivity
starts expected string have put there missing.
mainactivity.java:
public class mainactivity extends activity { public void onresume() { super.onresume(); string recmessage = this.getintent().getstringextra("message"); if(recmessage.equals("")) { log.v("recmessage", "none"); } else { log.v("recmessage", "something"); } // .. } }
statech.java:
public class statech extends service { //... private void notificationu(string title, string text) { //the intent launch when user clicks expanded notification intent intent = new intent(this, mainactivity.class); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); intent.putextra("message", "ssss"); intent.setaction("actionstring" + system.currenttimemillis()); pendingintent pendintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notification noti2 = new notificationcompat.builder(this) .setcontenttitle(title) .setcontenttext(text) .setsmallicon(r.drawable.warning) .setcontentintent(pendintent) .build(); mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); mnotificationmanager.notify(123456, noti2); } // ... }
check using textutils
if (!textutils.isempty(recmessage)) { // here require condition }
Comments
Post a Comment