Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3768

Troubles with (un)registering for mobile notifications (on iOS)

$
0
0

I am having issues with the (un)register functions for mobile notifications.

To activate notifications I use this code:

if not NotificationCenter.RegisteredForRemoteNotifications() then
  NotificationCenter.RequestAuthorization(MobileNotifications.AuthorizationOptions.Badge, MobileNotifications.AuthorizationOptions.Sound, MobileNotifications.AuthorizationOptions.Alert)
  NotificationCenter.RegisterForRemoteNotifications()
end if

And if the user no longer wants notifications I execute this code:

if NotificationCenter.RegisteredForRemoteNotifications() then
  NotificationCenter.UnregisterForRemoteNotifications()
end if

Registering for notifications initially works ( get a token through the RemoteRegistrationSucceeded() event ). When the user unregisters for notifications it does call NotificationCenter.UnregisterForRemoteNotifications() ( I have checked by putting a messagebox right before it)

But NotificationCenter.RegisteredForRemoteNotifications() always stays true. So it will never reregister for notifications and notificatsion also keep working so it looks like NotificationCenter.UnregisterForRemoteNotifications() just doesn’t work.

What am I doing wrong here?

7 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3768

Trending Articles