Skip to content

Commit 0df647c

Browse files
committed
compatible for android 12 within leancloud push notification
1 parent 4c6cad8 commit 0df647c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

android-sdk/leancloud-push-lite/src/main/java/cn/leancloud/push/lite/AVNotificationManager.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ private void sendNotification(String from, String msg, Intent resultIntent) {
283283
ComponentName cn = new ComponentName(context, clsName);
284284
resultIntent.setComponent(cn);
285285
PendingIntent contentIntent =
286-
PendingIntent.getActivity(context, notificationId, resultIntent, 0);
286+
PendingIntent.getActivity(context, notificationId, resultIntent,
287+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
287288
String sound = getSound(msg);
288289
Notification notification = null;
289290
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) {

android-sdk/realtime-android/src/main/java/cn/leancloud/push/AndroidNotificationManager.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ private void sendNotification(String from, String msg, Intent resultIntent) {
9494
ComponentName cn = new ComponentName(context, clsName);
9595
resultIntent.setComponent(cn);
9696
PendingIntent contentIntent =
97-
PendingIntent.getActivity(context, notificationId, resultIntent, 0);
97+
PendingIntent.getActivity(context, notificationId, resultIntent,
98+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
9899
String sound = getSound(msg);
99100
String title = getTitle(msg);
100101
String notificationChannel = getNotificationChannel(msg);

0 commit comments

Comments
 (0)