Fixed clear for Android 14

pull/214/head
M66B 1 year ago
parent 6bda014ba4
commit 415c5d189b

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2023 by Marcel Bokhorst (M66B)
*/
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -60,4 +61,9 @@ public class ActivityClear extends ActivityBase {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
static PendingIntent getPendingIntent(Context context) {
return PendingIntentCompat.getActivity(
context, 0, getIntent(context), PendingIntent.FLAG_UPDATE_CURRENT);
}
}

@ -25,6 +25,13 @@ import android.os.Build;
@TargetApi(Build.VERSION_CODES.N)
public class ServiceTileClear extends ServiceTileBase {
public void onClick() {
startActivityAndCollapse(ActivityClear.getIntent(this));
try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
startActivityAndCollapse(ActivityClear.getIntent(this));
else
startActivityAndCollapse(ActivityClear.getPendingIntent(this));
} catch (Throwable ex) {
Log.e(ex);
}
}
}

Loading…
Cancel
Save