Joel
Joel

Reputation: 16124

iOS - Ask to enable push notifications after initial decline

I would like to know if it's possible to force the "XXXXX would like to send you push notifications" popup from within an app, after an initial decline. The use case is as follows:

Any help would be appreciated. Thanks.

Upvotes: 39

Views: 26591

Answers (3)

Jeremy
Jeremy

Reputation: 31

The best way to do it would be to (if you're making a game) ask them a preemptive question (e.g. Do you want us to notify you when your crops are ready to be harvested? -Yes -No), and when they answer "yes", then fire the native iOS push popup. then you can layer in multiple questions along the user funnel, and you'll eventually catch them all.

Upvotes: 3

rob mayoff
rob mayoff

Reputation: 385700

You can't make iOS show the alert again. Here's a better approach:

  1. Keep a flag in your NSUserDefaults indicating whether you should register for push notifications at launch. By default the flag is false.
  2. When you launch, check the flag. If it's true, register immediately. Otherwise, don't register.
  3. The first time the user does something that would cause a push notification, register for push notifications and set the flag in NSUserDefaults.

This way, when the user gets the push notifications alert, he has some idea why he's getting it, and might actually say yes.

Upvotes: 53

Sailesh
Sailesh

Reputation: 26207

I am also facing a similar kind of issue. After searching so much, I decided to do what you call Plan B. That is, show the user my own alert saying that push needs to be enabled for better experience, or something like that.

To check that required push types are enabled, use this method:

- (UIRemoteNotificationType)enabledRemoteNotificationTypes

UIApplication reference

I think that this is the clean solution. Consider a case where after accepting the request at first, the user turns off push, this thing will work even in that scenario.

Upvotes: 4

Related Questions