Note that there are some explanatory texts on larger screens.

plurals
  1. PONotification throwing intents without it's extras
    primarykey
    data
    text
    <p>I am trying to launch an intent from a notification, but for a reason I don't know the extra is not always sent with the intent. This is where I create the intent :</p> <pre><code>NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, mContext.getString(R.string.text), 0); Intent intents = new Intent(mContext, DataAppTabs.class); intents.putExtra(DataAppTabs.REQUEST, DataAppTabs.REQUEST_DMTAB); intents.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent launchIntent = PendingIntent.getActivity(mContext.getApplicationContext(), DataAppTabs.REQUEST_DMTAB, intents, PendingIntent.FLAG_UPDATE_CURRENT); notification.setLatestEventInfo(mContext, "Info", mContext.getString(R.string.enginedmnotification_rebootneeded), launchIntent); notification.flags = Notification.FLAG_NO_CLEAR; notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE; notification.defaults = Notification.DEFAULT_ALL; notificationManager.notify(DataAppTabs.REQUEST_DMTAB, notification); </code></pre> <p>In the DataAppTabs class I overrided onCreate() and onNewIntent(). When the notification appears, if I click on it it opens the correct Activity (DataAppTabs, which is a TabActivity), it triggers onCreate or onNewIntent if the activity was already started, but the extra "REQUEST" is not always set (getExtras() is sometimes null).</p> <p>I have found the same question here with answers telling me I had to use the "FLAG_ACTIVITY_SINGLE_TOP" flag, but it still doesn't work all the time and I am not able to reproduce the problem every time.</p> <p>Is it something I did wrong ?<br> Thanks</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.
 

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