Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please try to modify the row:</p> <pre><code>PendingIntent pi = PendingIntent.getActivity(this, 0, navigationIntent, 0); </code></pre> <p>to</p> <pre><code>PendingIntent pi = PendingIntent.getActivity(this, 0, navigationIntent, Intent.FLAG_ACTIVITY_NEW_TASK); </code></pre> <p>Documentation:</p> <p>Note that the activity will be started outside of the context of an existing activity, so you must use the Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the Intent.</p> <p>Attached below my code. For me it is working properly.</p> <pre><code>private void showNotification() { Log.i(TAG, "showNotification called..."); final Intent notificationIntent = new Intent(this, UpdateApplicationActivity.class); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); final Notification notification = new Notification(R.drawable.htc_notification, getString(R.string.UpdateCheck_update_available), System.currentTimeMillis()); notification.defaults |= Notification.DEFAULT_ALL; notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE | Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_AUTO_CANCEL; notification.setLatestEventInfo(this, getString(R.string.UpdateCheck_notification_title), getString(R.string.UpdateCheck_notification_message), contentIntent); // Notifying the user about the new update. if (notificationManager != null) { notificationManager.notify(APP_UPDATE_NOTIFICATION, notification); } } </code></pre>
 

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