Android-从最新的应用程序中删除该应用程序不会终止该应用程序

时间:2019-06-11 08:13:32

标签: android

我尝试通过从最近使用的应用程序中刷杀应用程序,但是该应用程序仍然有效。有一个单例对象,用于将会话信息保留在Application类中。滑动后重新启动应用程序时,此单例仍然保留。因此,仍然存在有效的会话。 有时会发生这种情况,并且每次尝试都无法重现。用Uri开始活动后,可能会发生(我不确定)

val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse("myapp://someactivity")
startActivity(intent)

AndroidManifest.xml中的目标活动:

<activity
    android:name="TargetActivity"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="myapp" />
        <data android:scheme="myapp2" />
    </intent-filter>
    <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="@string/url_host"
            android:pathPrefix="@string/url1"
            android:scheme="https" />
        <data
            android:host="@string/url_host"
            android:pathPrefix="@string/url_2"
            android:scheme="https" />
    </intent-filter>
</activity>

我在各种Android版本(6、7、8)上都遇到了问题。

0 个答案:

没有答案
相关问题