Open ygpedroso opened 1 year ago
This pull request fixes all my problems I had with Cordova Android 11, too!
@ygpedroso Thanks. Working just fine.
This is similar to PR #1158 which was merged into master. The difference is this has an "If" condition.
int pendingIntentValueFLAG = PendingIntent.FLAG_UPDATE_CURRENT;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
pendingIntentValueFLAG = pendingIntentValueFLAG | PendingIntent.FLAG_IMMUTABLE;
}
final PendingIntent pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, pendingIntentValueFLAG);
@ygpedroso is this needed for backwards compatibility for older versions of Android?
yes I think so, 'cause on older Android Version (< Android S) You probably don't have the FLAG_IMMUTABLE flag.