Recent Apps(アプリ履歴、タスク一覧ともいうのかな?)に対象のActivityを非表示にするには、対象Activityがフォアグラウンドになければ
にある通り、AndroidManifest.xmlにて対象Activityの<activity>に
android:excludeFromRecents="true"
を指定してあげれば非表示になります。
問題は、対象Activityがフォアグラウンドにある場合で、その場合は、下記のようにexcludeFromRecents以外に色々と設定してあげる必要があります。
(TargetActivityはご自身のActivity名に読み変えてください)。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name=".TargetActivity" | |
android:label="@string/title_activity_target" | |
android:excludeFromRecents="true" | |
android:noHistory="true" | |
android:alwaysRetainTaskState="false" | |
android:stateNotNeeded="true" | |
android:clearTaskOnLaunch="true" | |
android:finishOnTaskLaunch="true" /> |
正直、各設定の詳細な意味は深く理解していません(汗
おまじないに近いです。
次の記事を参考にしました。
おまじないに近いです。
次の記事を参考にしました。
Issue 53313 - android - Foreground service killed when receiving broadcast after acitivty swiped away in task list - Android Open Source Project - Issue Tracker - Google Project Hosting
2015/11/7追記:
もっと簡単で確実な方法がありました。onPause()でsetTheme(android.R.style.Theme_NoDisplay)すれば良いです。
protected void onPause() { setTheme(android.R.style.Theme_NoDisplay); super.onPause(); }
0 件のコメント:
コメントを投稿