在唤醒app的activity 的manifest加上一句
android:excludeFromRecents="true"
有几个唤醒的就加几个
<activity android:excludeFromRecents="true" android:name=".activity.SplashActivity" android:exported="true" android:hardwareAccelerated="true" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:excludeFromRecents="true" android:name=".activity.MainActivity" android:exported="true" android:hardwareAccelerated="true" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> </activity>
这句代码只要是启动的根activity 就会隐藏recent记录 有问题的欢迎交流 比较懒写博客