Note that there are some explanatory texts on larger screens.

plurals
  1. POCorrect intent flags to use
    text
    copied!<p>Within my Main Activity that loads a Webview, depending on where it was launched from determines the url to load.</p> <pre><code>Bundle extras = getIntent().getExtras(); if (extras != null) { String theurl = getIntent().getExtras().getString("url"); webView.loadUrl(theurl); } else { webView.loadUrl("http://mysite.com"); } </code></pre> <p>If the application is a fresh instance and loaded from the home screen it loads the default url.</p> <p>If the application is not running and i click a notification that was sent through google cloud messaging the application loads a custom url.</p> <p>This functions as expected.</p> <p>My problem lies when the application is already running in the background, when i click a notification it will bring the app to the front but wont load the new url, it stays at the default.</p> <p>I'm not too sure with the Flags, i did have this problem before and it was a certain combination of flags that fixed it.</p> <pre><code> Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.putExtra("url", url); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK ); int requestID = (int) System.currentTimeMillis(); PendingIntent intent = PendingIntent.getActivity(context, requestID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT); </code></pre> <p>Help would be greatly appreciated.</p> <p><em>EDIT</em></p> <p>If i add the flag PendingIntent.FLAG_CANCEL_CURRENT this almost solves the issue, although it reloads the whole main activity (Splash screen gets called), i want it to reuse the existing webview.</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