Skip to content

Commit c94da65

Browse files
updated pending intent to support sdk 31 and above
1 parent 355d34e commit c94da65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

debugoverlay/src/main/java/com/ms_square/debugoverlay/DebugOverlayService.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ private PendingIntent getNotificationIntent(String action) {
202202
if (config.getActivityName() != null) {
203203
try {
204204
Intent intent = new Intent(this, Class.forName(config.getActivityName()));
205-
pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
205+
pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
206+
PendingIntent.getActivity(this, PendingIntent.FLAG_MUTABLE, intent, PendingIntent.FLAG_CANCEL_CURRENT);
207+
}else{
208+
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
209+
}
206210
} catch (ClassNotFoundException ne) {
207211
Log.w(TAG, config.getActivityName() + " was not found - " + ne.getMessage());
208212
}

0 commit comments

Comments
 (0)