More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Sunday, 13 October 2019 2:32:01 PM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 23/11/2008(UTC)
Posts: 521

Xamarin Forms - How to disable Andoid app restart on push notifications

Address the app reload issue:

Set LaunchMode to SingleTop or Single Task in MainActivity, ie  just add the launch mode to your app's MainActivity.

[Activity(LaunchMode = LaunchMode.SingleTop,...

Add activity flags to an intent object, eg.

   

Code:
var intent = new Intent(this, typeof(MainActivity));
    intent.AddFlags(ActivityFlags.ClearTop);

LaunchMode.SingleTop together with ActivityFlags.ClearTop flag:

Clears the Activity stack back to (but NOT including) the target Activity (by finishing all activities in the stack that were on top of the target activity). Calls onNewIntent() on the existing instance of the target Activity, passing the Intent that was used in the startActivity() call.

See Why do people like to pair CLEAR_TOP and SINGLE_TOP in android.

-------------------------------------------------

More on Andoid Activity Launch Mode:

https://developer.android.com/guide/topics/manifest/activity-element

Android “launchMode” (Visualized)

Understand Android Activity's launchMode: standard, singleTop, singleTask and singleInstance

The Android Launch Mode Animated CheatSheet

Android Activity Launch Mode

Difference between SingleTask and SingleInstance

App Reload on Push Notification Click Xamarin Forms

Edited by user Sunday, 13 October 2019 2:59:57 PM(UTC)  | Reason: Not specified

Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.