Created
September 2, 2018 17:22
-
-
Save tugcearar/013f4b18b6090043d3c22afe36d60216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: Dependency(typeof(ChangeIconService))] | |
namespace XamarinFormsChangeIcon.iOS.Helpers | |
{ | |
public class ChangeIconService : IChangeIconService | |
{ | |
NSError error = new NSError(); | |
public ChangeIconService() | |
{ | |
} | |
public void ChangeIcon(string iconName) | |
{ | |
var name = UIApplication.SharedApplication.AlternateIconName; | |
if (iconName != null) | |
UIApplication.SharedApplication.SetAlternateIconName(iconName, (err) => | |
{ | |
Console.WriteLine("Set Alternative Icon: {0}", err); | |
}); | |
else | |
UIApplication.SharedApplication.SetAlternateIconName(null, (err) => { | |
Console.WriteLine("Set Primary Icon: {0}", err); | |
}); | |
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 7; | |
} | |
void HandleAction(NSError obj) | |
{ | |
Console.Write(obj.ToString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment