rdelrosario / xamarin-plugins

Cross platform Xamarin & Windows plugins for PCLs
MIT License
178 stars 161 forks source link

How to clear or change Badge in iOS / Android locally #110

Open TimesliceTechnologies opened 7 years ago

TimesliceTechnologies commented 7 years ago

It would be nice to have a method that would allow either clearing or changing the Badge. IE: Once the user has reviewed notification(s) within our app, I want to be able to reset the badge from within our cross platform app.

Currently it seems the badge will change based on the badge value received by the notification, however there doesn't seem to be a way to reset the badge locally.

Is there a way to do this? If not, is there a relatively easy technique for doing this in Xamarin Forms, and ultimately could this feature be added within the plug-in?

iManchaDev commented 7 years ago

On iOS at the moment I just reset the badge count when the app comes into the foreground:

public override void OnActivated(UIApplication uiApplication) { UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; base.OnActivated(uiApplication); } not the best solution, especially when using badges on the tabs within the app.

Busy with the the android implementation and then back to iOS, if I get something solid worked out for both, will let you know.

TimesliceTechnologies commented 7 years ago

Thanks for the interim workaround - I'll give that a whirl. It would be nice to see this incorporated into the plug in in the near future just to complete the feature set.

iManchaDev commented 7 years ago

@TimesliceTechnologies So I gave up getting this plugin to work properly with Firebase, and especially the iOS side of things. Using OneSignal Xamarin SDK, surprisingly easy to implement and a lot of features on their console, plus it's free(supports unlimited devices and notifications)