prevent crashes from update notifications on < android-11
closes #1306 * https://stackoverflow.com/questions/3112008/android-java-lang-illegalargumentexception-contentintent-required-error-cause * https://stackoverflow.com/questions/20032249/is-setcontentintentpendingintent-required-in-notificationcompat-builder
This commit is contained in:
parent
96fb01ca52
commit
8600ce8d8a
@ -433,6 +433,12 @@ class NotificationHelper {
|
|||||||
intentDeleted.setClass(context, NotificationBroadcastReceiver.class);
|
intentDeleted.setClass(context, NotificationBroadcastReceiver.class);
|
||||||
PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
builder.setDeleteIntent(piDeleted);
|
builder.setDeleteIntent(piDeleted);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < 11) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
builder.setContentIntent(PendingIntent.getActivity(context, 0, intent, 0));
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user