Activity.OnNewIntent Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OnNewIntent(Intent) |
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the |
OnNewIntent(Intent, ComponentCaller) |
Same as |
OnNewIntent(Intent)
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the Intent#FLAG_ACTIVITY_SINGLE_TOP
flag when calling #startActivity
.
[Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;)V", "GetOnNewIntent_Landroid_content_Intent_Handler")]
protected virtual void OnNewIntent (Android.Content.Intent? intent);
[<Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;)V", "GetOnNewIntent_Landroid_content_Intent_Handler")>]
abstract member OnNewIntent : Android.Content.Intent -> unit
override this.OnNewIntent : Android.Content.Intent -> unit
Parameters
- intent
- Intent
The new intent that was used to start the activity
- Attributes
Remarks
This is called for activities that set launchMode to "singleTop" in their package, or if a client used the Intent#FLAG_ACTIVITY_SINGLE_TOP
flag when calling #startActivity
. In either case, when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch it.
An activity can never receive a new intent in the resumed state. You can count on #onResume
being called after this method, though not necessarily immediately after the completion of this callback. If the activity was resumed, it will be paused and new intent will be delivered, followed by #onResume
. If the activity wasn't in the resumed state, then new intent can be delivered immediately, with #onResume()
called sometime later when activity becomes active again.
Note that #getIntent
still returns the original Intent. You can use #setIntent(Intent)
to update it to this new Intent.
Java documentation for android.app.Activity.onNewIntent(android.content.Intent)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
See also
Applies to
OnNewIntent(Intent, ComponentCaller)
Same as #onNewIntent(Intent)
, but with an extra parameter for the ComponentCaller
instance associated with the app that sent the intent.
[Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;Landroid/app/ComponentCaller;)V", "GetOnNewIntent_Landroid_content_Intent_Landroid_app_ComponentCaller_Handler", ApiSince=35)]
public virtual void OnNewIntent (Android.Content.Intent intent, Android.App.ComponentCaller caller);
[<Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;Landroid/app/ComponentCaller;)V", "GetOnNewIntent_Landroid_content_Intent_Landroid_app_ComponentCaller_Handler", ApiSince=35)>]
abstract member OnNewIntent : Android.Content.Intent * Android.App.ComponentCaller -> unit
override this.OnNewIntent : Android.Content.Intent * Android.App.ComponentCaller -> unit
Parameters
- intent
- Intent
The new intent that was used to start the activity
- caller
- ComponentCaller
The ComponentCaller
instance associated with the app that sent the
intent
- Attributes
Remarks
Same as #onNewIntent(Intent)
, but with an extra parameter for the ComponentCaller instance associated with the app that sent the intent.
If you want to retrieve the caller without overriding this method, call #getCurrentCaller
inside your existing #onNewIntent(Intent)
.
Note that you should only override one #onNewIntent
method.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.