Note that there are some explanatory texts on larger screens.

plurals
  1. POputExtra using pending intent not working
    primarykey
    data
    text
    <p>I have written a code in my GCMIntentservice that sends push notifications to many users. I use the NotificationManager that will call DescriptionActivity class when the notification is clicked. I also send the event_id form the GCMIntentService to the DescriptionActivity</p> <pre><code>protected void onMessage(Context ctx, Intent intent) { message = intent.getStringExtra("message"); String tempmsg=message; if(message.contains("You")) { String temparray[]=tempmsg.split("="); event_id=temparray[1]; } nm= (NotificationManager)getSystemService(NOTIFICATION_SERVICE); intent = new Intent(this, DescriptionActivity.class); Log.i("the event id in the service is",event_id+""); intent.putExtra("event_id", event_id); intent.putExtra("gcmevent",true); PendingIntent pi = PendingIntent.getActivity(this,0, intent, 0); String title="Event Notifier"; Notification n = new Notification(R.drawable.defaultimage,message,System.currentTimeMillis()); n.setLatestEventInfo(this, title, message, pi); n.defaults= Notification.DEFAULT_ALL; nm.notify(uniqueID,n); sendGCMIntent(ctx, message); } </code></pre> <p>Here the event_id that I'm getting in the above method is correct i.e I always get the updated one. But in the code below (DescriptionActivity.java):</p> <pre><code> intent = getIntent(); final Bundle b = intent.getExtras(); event_id = Integer.parseInt(b.getString("event_id")); </code></pre> <p>The event_id here is always "5". No matter what I putExtra in the GCMIntentService class,the event_id I get is always 5. Can somebody please point out the problem? Is is because of the pending intent? If yes, then how should I handle it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload