Android push message issue, getting old message always on display screen -


please me out. stuck gcm push message. working perfect when trying display message on next screen getting old 1 or first one. if check log cat, getting new message server. problem not getting. have tried many code on stackoverflow. here snippet of code-

// service class public class gcmintentservice extends gcmbaseintentservice {     public gcmintentservice() {         super(sender_id);     }  // onmessage revive method      @override     protected void onmessage(context context, intent intent) {         log.i(tag, "new message= ");         string message = intent.getextras().getstring("message");         generatenotification(context, message);         system.out.println(message+"++++++++++1");     }  // notification method  private void generatenotification(context context, string message) {         system.out.println(message+"++++++++++2");         int icon = r.drawable.ic_launcher;         long when = system.currenttimemillis();         notificationmanager notificationmanager = (notificationmanager) context.getsystemservice(context.notification_service);         notification notification = new notification(icon, message, when);         string title = context.getstring(r.string.app_name);         string subtitle = "important news you!";         intent notificationintent = new intent(context, notificationview.class);         notificationintent.putextra("content", message);          //pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current);          //pendingintent intent = pendingintent.getactivity(context, 0,notificationintent, 0);          pendingintent intent =  pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current);          notificationintent.setflags(intent.flag_activity_clear_top| intent.flag_activity_single_top);          notification.setlatesteventinfo(context, title, subtitle, intent);         //to play default sound notification:         notification.defaults |= notification.default_sound;         notification.flags |= notification.flag_auto_cancel;         notification.defaults |= notification.default_vibrate;         notificationmanager.notify(0, notification);     }  public class notificationview extends activity {     // , next activity displaying push message-     intent intent=getintent();                     stringvalue=intent.getstringextra("content");                      system.out.println(stringvalue); 

i have try-

pendingintent intent = pendingintent.getactivity(context, 0,notificationintent, 0);

and this- pendingintent intent = pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current);

both did not work me.

code fine ,try using string buffer may because string data cant change unless new specified every time im new here give me vote :)


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -