Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Update an activity for a local notification

$
0
0

Hi,

I am creating a local notification and adding an activity in the android part of my xamarin forms project using this code which creates a button that says: "Start Work":

PendingIntent startWorkIntent =
PendingIntent.GetActivity(AndroidApp.Context, pendingIntentId, intent, PendingIntentFlags.UpdateCurrent);
builder.AddAction(Resource.Drawable.workGreen, "Start Work", startWorkIntent);

My question is once I have sent the message to the system using:

notification = builder.Build();
manager.Notify(messageId, notification);

how can I modify the text and the text on the button?

Currently I am canceling the notification using manager.CancelAll(); and then creating a new notification but that doesn't seem very elegant.

Also looking at the documentation for AddAction (https://docs.microsoft.com/en-us/dotnet/api/android.app.notification.builder.addaction?view=xamarin-android-sdk-9#applies-to) it states:

Warning
This API is now obsolete.

What should we be using instead of AddAction?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>