Maduranga E
Maduranga E

Reputation: 1689

iOS - How to track user choice for push notification on an iOS app?

My app is written to continue from didRegisterForRemoteNotificationsWithDeviceToken method by sending the device token to the server.

How do I track if the user has not allowed push notifications for the app upon the first install? I'm using urban airship push notifications.

Thanks in advance.

Upvotes: 0

Views: 858

Answers (1)

SinzianaG
SinzianaG

Reputation: 174

didRegisterForRemoteNotificationsWithDeviceToken will return only if the user has accepted push notifications ( It will return the token if the device is online and iOS can reach the APNs in order to generate it or null if the device is not online ).

The only thing you can do is make an assumption: If didRegisterForRemoteNotificationsWithDeviceToken was not called after T amount of time then the user has not accepted.

But if you do this you should make sure you take into consideration the time that the user spends reading/deciding with the push notification opt in dialog displayed. Since it's a native dialog the app will be sent into the background so if you are using a timer you should probably start it as soon as the app becomes active again.

Upvotes: 1

Related Questions