android - Intent extras not received -


I am displaying a notification from a library attached to my project, when notification is clicked, notification activity ReceivingActivity ). Activity is opened after clicking on notification, but Extras associated with it are not received.

Notification trigger code - I call sendNotification when I get a GCM message and the notification code is in the library

  public static final Difference NOTIFICATION_ID = 1; Private Notification Manager mNotificationManager; NOTIFICATION COMPANY. Builder Builder; Private Zero Send Notification (Bundle Extras) {mNotificationManager = (Notification Manager) this.getSystemService (context.NOTIFICATION_SERVICE); Intent redirectIntent = new intent (this, orbit.forName ("com.xyz.kljdf.ReceivingActivity")); redirectIntent.putExtra ("key", "value"); // These extras are not received for receiving on the buyer (), see the pending content of the code below INTent = PendingIntent.getActivity (this, 0, redirectIntent, 0); NotificationCompat.Builder mBuilder = New Notification GetIdentifier ("icon", "drawable", getPackageName ()) .setContentTitle (extras.getString (PushConstants TITLE)) .setStyle (new notification) . BigTextStyle () .bigText (extras.getString (PushConstants.ALERT)) .setContentText (extras.getString (PushConstants.ALERT)); MBuilder.setContentIntent (contentIntent); mNotificationManager.notify (NOTIFICATION_ID, mBuilder.build ()); }   

Checking Extras in Receiving Activity ...

  Public Empty Crate {bundle saved instenstate} {super.onCreate (savedInstanceState); setContentView (R.layout.activity_receiving); Log.i ("extras ..... @@@@", getIntent (). GetExtras (.) ToString ()); // NPE here}   

I need help in finding out how to pass extras and get them right.

Make sure the pending agent is actually passing the data when it is called the explanation See this answer for:

For anybody else, if you are positive then the intent is already present and only brought forward, the data of the new intent will not be passed by default. You can override the newentant to reach it:

  @Noventure on the protected void (intent) {super.onNewIntent}; setIntent; // Set new intent data for the current intent}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -