fix(launch): when open the app from launcher, stay current activity

This commit is contained in:
CCG committed 2019-12-08 20:07:05 +08:00
1 parent b38d9ec95e
commit 9967601e3e
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@
android:name=".MainActivity"
android:label="@string/launch_name"
android:screenOrientation="portrait"
android:launchMode="singleTask">
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -29,12 +29,14 @@ class ClashNotification(private val context: Service) {
.setContentIntent(
PendingIntent.getActivity(
context,
CLASH_STATUS_NOTIFICATION_ID,
(Math.random() * 100).toInt(),
Intent().setComponent(
ComponentName.createRelative(
context,
MAIN_ACTIVITY_NAME
)
).setFlags(
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
),
PendingIntent.FLAG_UPDATE_CURRENT
)