@@ -304,7 +304,7 @@ await MyGeofencingClient
304
304
/// <returns></returns>
305
305
protected virtual PendingIntent CreateGeofenceIntent ( int notificationId , string serializedRequest )
306
306
{
307
- var pendingIntent = CreateActionIntent ( serializedRequest , new NotificationAction ( notificationId )
307
+ var pendingIntent = CreateActionIntent ( notificationId , serializedRequest , new NotificationAction ( 0 )
308
308
{
309
309
Android =
310
310
{
@@ -367,7 +367,7 @@ internal virtual bool ShowLater(NotificationRequest request)
367
367
/// <returns></returns>
368
368
protected virtual PendingIntent CreateAlarmIntent ( int notificationId , string serializedRequest )
369
369
{
370
- var pendingIntent = CreateActionIntent ( serializedRequest , new NotificationAction ( notificationId )
370
+ var pendingIntent = CreateActionIntent ( notificationId , serializedRequest , new NotificationAction ( 0 )
371
371
{
372
372
Android =
373
373
{
@@ -538,7 +538,7 @@ internal virtual async Task<bool> ShowNow(NotificationRequest request)
538
538
539
539
var serializedRequest = LocalNotificationCenter . GetRequestSerialize ( request ) ;
540
540
541
- var contentIntent = CreateActionIntent ( serializedRequest , new NotificationAction ( NotificationActionEventArgs . TapActionId )
541
+ var contentIntent = CreateActionIntent ( request . NotificationId , serializedRequest , new NotificationAction ( NotificationActionEventArgs . TapActionId )
542
542
{
543
543
Android =
544
544
{
@@ -547,7 +547,7 @@ internal virtual async Task<bool> ShowNow(NotificationRequest request)
547
547
}
548
548
} , typeof ( NotificationActionReceiver ) ) ;
549
549
550
- var deleteIntent = CreateActionIntent ( serializedRequest , new NotificationAction ( NotificationActionEventArgs . DismissedActionId )
550
+ var deleteIntent = CreateActionIntent ( request . NotificationId , serializedRequest , new NotificationAction ( NotificationActionEventArgs . DismissedActionId )
551
551
{
552
552
Android =
553
553
{
@@ -689,7 +689,7 @@ protected virtual async Task<Bitmap> GetNativeImage(NotificationImage notificati
689
689
protected virtual NotificationCompat . Action CreateAction ( NotificationRequest request , string serializedRequest ,
690
690
NotificationAction action )
691
691
{
692
- var pendingIntent = CreateActionIntent ( serializedRequest , action , typeof ( NotificationActionReceiver ) ) ;
692
+ var pendingIntent = CreateActionIntent ( request . NotificationId , serializedRequest , action , typeof ( NotificationActionReceiver ) ) ;
693
693
if ( string . IsNullOrWhiteSpace ( action . Android . IconName . ResourceName ) )
694
694
{
695
695
action . Android . IconName = request . Android . IconSmallName ;
@@ -704,11 +704,12 @@ protected virtual NotificationCompat.Action CreateAction(NotificationRequest req
704
704
/// <summary>
705
705
///
706
706
/// </summary>
707
+ /// <param name="notificationId"></param>
707
708
/// <param name="serializedRequest"></param>
708
709
/// <param name="action"></param>
709
710
/// <param name="broadcastReceiverType"></param>
710
711
/// <returns></returns>
711
- protected virtual PendingIntent CreateActionIntent ( string serializedRequest , NotificationAction action , Type broadcastReceiverType )
712
+ protected virtual PendingIntent CreateActionIntent ( int notificationId , string serializedRequest , NotificationAction action , Type broadcastReceiverType )
712
713
{
713
714
var notificationIntent = action . Android . LaunchAppWhenTapped
714
715
? ( Application . Context . PackageManager ? . GetLaunchIntentForPackage ( Application . Context . PackageName ??
@@ -720,7 +721,9 @@ protected virtual PendingIntent CreateActionIntent(string serializedRequest, Not
720
721
. PutExtra ( LocalNotificationCenter . ReturnRequestActionId , action . ActionId )
721
722
. PutExtra ( LocalNotificationCenter . ReturnRequest , serializedRequest ) ;
722
723
723
- var requestCode = _random . Next ( ) ;
724
+ //var requestCode = _random.Next();
725
+ // Cannot be random, then you cannot cancel it.
726
+ var requestCode = notificationId + action . ActionId ;
724
727
725
728
var pendingIntent = action . Android . LaunchAppWhenTapped
726
729
? PendingIntent . GetActivity (
0 commit comments