Note that there are some explanatory texts on larger screens.

plurals
  1. POgetIntent() Extras always NULL
    text
    copied!<p>I wrote a simple Android App that show a custom Notification like this:</p> <pre><code>Context context = getApplicationContext(); NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification( R.drawable.icon, title, System.currentTimeMillis()); Intent notificationIntent = new Intent( context, this.getClass()); notificationIntent.putExtra("com.mysecure.lastpage", "SECURECODE"); PendingIntent pendingIntent = PendingIntent.getActivity( context , 0, notificationIntent, 0); notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT; notification.contentView = new RemoteViews(context.getPackageName(), R.layout.notifypbar); notification.contentIntent = pendingIntent; notification.contentView.setTextViewText(R.id.notifypb_status_text, text); notification.contentView.setProgressBar(R.id.notifypb_status_progress, 100, (int)(100*progress), false); manager.notify(104, notification); </code></pre> <p>This piece of code is called ONLY ONCE in my application and it displays a notification with a progress bar (all correctly).</p> <p>Now, when a user clicks on this notification my application handles the <code>onResume</code> event.</p> <pre><code>public void onResume() { super.onResume(); // TODO: Extras è SEMPRE NULL!!! impossibile! Intent callingintent = getIntent(); Bundle extras = callingintent.getExtras(); </code></pre> <p>but extras is always NULL!</p> <p>I've tried any combination of:</p> <pre><code>notificationIntent.putExtra("com.mysecure.lastpage", "SECURECODE"); </code></pre> <p>or</p> <pre><code>Bundle extra = new Bundle(); extra.putString(key, value); notificationIntent.putExtra(extra); </code></pre> <p>but getIntent().getExtras() returns always NULL.</p>
 

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