Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable autoRegister on init #1

Closed
stasix opened this issue Jun 16, 2015 · 13 comments
Closed

Cannot disable autoRegister on init #1

stasix opened this issue Jun 16, 2015 · 13 comments

Comments

@stasix
Copy link

stasix commented Jun 16, 2015

Hi!

I cannot disable autoRegister. Passing false to autoRegister in initWithLaunchOptions does not help and still triggers automatic registration. I need to delay the registration.
I'm using 1.9.0 version.

I'd appreciate any help.

@jkasten2
Copy link
Member

Hello,

I just tested version 1.9.0 with autoRegister: false and it working correctly. Which version of iOS are you seeing this issue on?

How are you resetting the push notification prompt? If your turning off the device when you see the prompt you will need to fully uninstall the app and reinstall it before opening it again. Otherwise iOS will reprompt the user right way when the app opens.

See our documentation on Resetting the iOS Notification Permission Prompt.

Thanks.

@stasix
Copy link
Author

stasix commented Jun 18, 2015

Hi, thanks for the quick prompt.
I'm seeing this on iOS9.

On Thursday, June 18, 2015, Josh Kasten [email protected] wrote:

Hello,

I just tested version 1.9.0 with autoRegister: false and it working
correctly. Which version of iOS are you seeing this issue on?

How are you resetting the push notification prompt? If your turning off
the device when you see the prompt you will need to fully uninstall the app
and reinstall it before opening it again. Otherwise iOS will reprompt the
user right way when the app opens.

See our documentation on Resetting the iOS Notification Permission Prompt
http://documentation.onesignal.com/v2.0/docs/common-problems#resetting-the-ios-notification-permission-prompt
.

Thanks.


Reply to this email directly or view it on GitHub
#1 (comment)
.

Stas Goferman
CEO, Bazaart http://www.bazaart.me/

@jkasten2
Copy link
Member

Hello, sorry about the delay. I identified an issue where our SDK prompts for push notifications on the 2nd cold start of the app. This seems to be an issue on iOS 8+ devices. I'll attach a commit to this issue when I have a fix.

Thanks.

@stasix
Copy link
Author

stasix commented Jun 22, 2015

Great! Thanks!

Stas Goferman
CEO, Bazaart http://www.bazaart.me/

On Tue, Jun 23, 2015 at 12:33 AM, Josh Kasten [email protected]
wrote:

Hello, sorry about the delay. I identified an issue where our SDK prompts
for push notifications on the 2nd cold start of the app. I'll attach a
commit to this issue when I have a fix.

Thanks.


Reply to this email directly or view it on GitHub
#1 (comment)
.

jkasten2 added a commit that referenced this issue Jun 23, 2015
* Fixed issue where the iOS notification permission prompt would show on the 2nd cold start of the app when autoRegister is set to false.
@stasix
Copy link
Author

stasix commented Jun 23, 2015

@jkasten2, can you update the pod as well to 1.9.2?

@jkasten2
Copy link
Member

Just pushed our update to cocoa pods. Let us know if this version fixes the issue for you and we can close this issue.

Thanks.

@stasix
Copy link
Author

stasix commented Jun 25, 2015

didRegisterForRemoteNotificationsWithDeviceToken is being called when I init OneSignal on the app launch. Maybe it's an iOS9 issue.
Instead, I'm deferring OneSignal init with autoRegister set to True at a later stage in the app. Seems to work.

@jkasten2
Copy link
Member

Are you seeing the iOS notification permission prompt when OneSignal initWithLaunchOptions is called with autoRegister: false? Or just seeing the firing of application:didRegisterForRemoteNotificationsWithDeviceToken:?

I have tested 1.9.2 of our OneSignal SDK with iOS 8.2 and iOS 9 beta 2 and autoRegister: false does not prompt the user for the notification permissions.

The UIApplicationDelegate application:didRegisterForRemoteNotificationsWithDeviceToken: selector is always fired from the OneSignal initWithLaunchOptions: selectors as it always calls [[UIApplication sharedApplication] registerForRemoteNotifications] on iOS 8+ devices. This is ok as it does not prompt the user for notification permissions. The call to registerUserNotificationSettings: inside of OneSignal's registerForPushNotifications selector does the prompting. The autoRegister could be better named as autoPrompt but this was named this way before iOS 8 was released.

If you defer OneSignal init the notification opened callback, session count, total playtime, IAP tracking, as well as any other selector that requires a OneSignal instance will not work.

Thanks.

@stasix
Copy link
Author

stasix commented Jun 28, 2015

I'm seeing the firing of application:didRegisterForRemoteNotificationsWithDeviceToken without prompt. So I understand this is a desired behaviour.
I defer OneSignal init, only the first time, until the user is prompted at a specific point in the app. In the successive app launches, OneSignal inits on launch. It this OK?

@jkasten2
Copy link
Member

Correct, the firing of application:didRegisterForRemoteNotificationsWithDeviceToken when your app starts is by design. It shouldn't create an issue, do you have another SDK/plugin this is creating a problem with?

We would prefer to understand and fix the issue however if you need to go this route with your app you will need to wrap any other method calls to OneSignal with your same logic. We did not intend for OneSignal not be called when your app starts. You also won't be able to see your user opt in rate on our dashboard and anything the user does before accepting will not be included in their totals.

Thanks.

@stasix
Copy link
Author

stasix commented Jul 9, 2015

Josh, we have some logic in application:didRegisterForRemoteNotificationsWithDeviceToken with another functionality.
How is application:didRegisterForRemoteNotificationsWithDeviceToken fired without user prompt in the first run? Is the deviceToken in such case is nil?

@jkasten2
Copy link
Member

jkasten2 commented Jul 9, 2015

In iOS 8 Apple split up push notifications into 2 parts.

See the documentation on registerForRemoteNotifications for the source of what I explained above.

If you only want to get the deviceToken/pushPush token if the user accepted permissions to display notifications you can use OneSignal's IdsAvailable: selector. pushToken will be nil if the user has not accepted the prompt yet or disabled notifications in the system settings for your app.

Thanks.

@stasix
Copy link
Author

stasix commented Jul 10, 2015

@jkasten2 - Thanks for clarifying this and for your time. This makes a lot sense now.
btw, we love OneSignal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants