简体   繁体   English

关闭在另一个应用程序上方打开的应用程序

[英]Close my application open on top of another app

When clicking on a Firebase dynamic link in another application (my application is not started), my application will open on top of that app. 在另一个应用程序中单击Firebase动态链接时(我的应用程序未启动),我的应用程序将在该应用程序顶部打开。 When I close the app, my app is not being closed properly. 当我关闭应用程序时,我的应用程序未正确关闭。 I clicked on my app icon, my app back to the foreground. 我点击了我的应用程序图标,我的应用程序回到了前台。 However, I can't see my app on the recent app list and therefore can't close it. 但是,我在最近的应用列表中看不到我的应用,因此无法将其关闭。

1) Any way to close my app properly? 1)有什么办法可以正常关闭我的应用程序吗? How to handle that? 如何处理? 2) I have already set the launch mode to singleTask. 2)我已经将启动模式设置为singleTask。 Why is it still open on top of another app when my app is not in the background (closed)? 当我的应用程序不在后台(关闭)时,为什么它仍在另一个应用程序的顶部打开? I expected it to start a new task, which I able to close both apps separately. 我希望它可以启动一个新任务,可以分别关闭两个应用程序。 * I tested on pre lollipop Android version *我在棒棒糖Android版之前进行了测试

AndroidManifest Android清单

    <!-- App Activities -->
    <activity
        android:name=".activity.SplashActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:launchMode="singleTask"
        android:taskAffinity="">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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:host="www.xxx.com" android:scheme="https"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".activity.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.statusBarNoActionBar" />

This solution works for me. 这个解决方案对我有用。 Please try to add on activity 请尝试增加活动

override fun onStop() {
    super.onStop()
}

override fun onUserLeaveHint() {
    super.onUserLeaveHint()
    this.onStop()
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM