Home > Net >  Don't destroy activity
Don't destroy activity

Time:03-15

my app/activity (starts a tracking) can be started from another app. In my case the app is called from browser. I added an intent filter for incoming links.

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data
        android:host="destination"
        android:scheme="mwde" />
</intent-filter>

This works fine. My problem is, that when user start the activity again, the onDestroyed function is called, but I don't want that in this case. Is there any way to prevent this?

CodePudding user response:

Try to use this flag in the app manifest https://developer.android.com/guide/topics/manifest/activity-element#lmode

CodePudding user response:

Where is the function onDestroyed(), where and how do you call it? Maybe you can limit when do you want to call it there. Also, see documentation on Activity Lifecycle where you have in detail explained how onDestroy works "under the hood". And sorry for making answer of comment, but because I am new here can't make comments yet

  • Related