Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected override void OnStart()
- {
- // This should come before AppCenter.Start() is called
- // Avoid duplicate event registration:
- if (!AppCenter.Configured)
- {
- Push.PushNotificationReceived += (sender, e) =>
- {
- var title = e.Title;
- var message = e.Message;
- // If app is in background title and message are null
- // App in foreground
- if (!string.IsNullOrEmpty(title))
- {
- foreach (string key in e.CustomData.Keys)
- {
- if (e.CustomData[key] == Settings.WorkerID)
- {
- Current.MainPage.DisplayAlert(title, message, "OK");
- }
- }
- }
- };
- }
- // Handle when your app starts
- AppCenter.Start("android=xxxxxxxxxxxxxxxxxx", typeof(Push));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement