diff --git a/src/Plugin.AzurePushNotification/DefaultPushNotificationHandler.android.cs b/src/Plugin.AzurePushNotification/DefaultPushNotificationHandler.android.cs index cffd1db..d1628f7 100644 --- a/src/Plugin.AzurePushNotification/DefaultPushNotificationHandler.android.cs +++ b/src/Plugin.AzurePushNotification/DefaultPushNotificationHandler.android.cs @@ -297,7 +297,7 @@ public virtual void OnReceived(IDictionary parameters) resultIntent.SetFlags(AzurePushNotificationManager.NotificationActivityFlags.Value); } int requestCode = new Java.Util.Random().NextInt(); - var pendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent,PendingIntentFlags.UpdateCurrent); + var pendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent, PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable); var chanId = AzurePushNotificationManager.DefaultNotificationChannelId; if (parameters.TryGetValue(ChannelIdKey, out object channelId) && channelId != null) @@ -318,7 +318,7 @@ public virtual void OnReceived(IDictionary parameters) notificationBuilder.SetLargeIcon(largeIconBitmap); } var deleteIntent = new Intent(context,typeof(PushNotificationDeletedReceiver)); - var pendingDeleteIntent = PendingIntent.GetBroadcast(context, requestCode, deleteIntent,PendingIntentFlags.CancelCurrent); + var pendingDeleteIntent = PendingIntent.GetBroadcast(context, requestCode, deleteIntent, PendingIntentFlags.CancelCurrent | PendingIntentFlags.Immutable); notificationBuilder.SetDeleteIntent(pendingDeleteIntent); if (Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.O) @@ -428,7 +428,7 @@ public virtual void OnReceived(IDictionary parameters) extras.PutString(ActionIdentifierKey, action.Id); actionIntent.PutExtras(extras); - pendingActionIntent = PendingIntent.GetActivity(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent); + pendingActionIntent = PendingIntent.GetActivity(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable); } else @@ -436,7 +436,7 @@ public virtual void OnReceived(IDictionary parameters) actionIntent = new Intent(context, typeof(PushNotificationActionReceiver)); extras.PutString(ActionIdentifierKey, action.Id); actionIntent.PutExtras(extras); - pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent); + pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable); } diff --git a/src/Plugin.AzurePushNotification/PNMessagingService.android.cs b/src/Plugin.AzurePushNotification/PNMessagingService.android.cs index b9145ae..383a570 100644 --- a/src/Plugin.AzurePushNotification/PNMessagingService.android.cs +++ b/src/Plugin.AzurePushNotification/PNMessagingService.android.cs @@ -2,13 +2,13 @@ using System.Linq; using Android.App; -using Android.Content; using Firebase.Messaging; namespace Plugin.AzurePushNotification { - [Service] + [Service(Exported = false)] [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })] + // ReSharper disable once InconsistentNaming public class PNMessagingService : FirebaseMessagingService { public override void OnMessageReceived(RemoteMessage message)