Nikhil Dekhane
Nikhil Dekhane

Reputation: 101

Xamarin.iOS Notification Suggestion

Need to show notification in Xamarin.iOS app.
Calling web service at some interval when application in background
Any better approach ?

Thanks in Advance !

Upvotes: 0

Views: 56

Answers (1)

Piyush Kumar
Piyush Kumar

Reputation: 51

For this, you can use local notification. You can use below code where you are calling web service:

// create the notification

var notification = new UILocalNotification();

// set the fire date (the date time in which it will fire)
notification.FireDate = NSDate.FromTimeIntervalSinceNow(60);

// configure the alert
notification.AlertAction = "View Alert";
notification.AlertBody = "Your one minute alert has fired!";

// modify the badge
notification.ApplicationIconBadgeNumber = 1;

// set the sound to be the default sound
notification.SoundName = UILocalNotification.DefaultSoundName;

// schedule it
UIApplication.SharedApplication.ScheduleLocalNotification(notification);

Upvotes: 1

Related Questions