Skip to content

Cannot disable autoRegister on init #1

Closed

Description

@stasix

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.

Activity

  1. jkasten2 commented on Jun 17, 2015

    @jkasten2
    Contributor

    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.

  2. stasix commented on Jun 18, 2015

    @stasix
    Author

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

    On Thursday, June 18, 2015, Josh Kasten notifications@github.com 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/

  3. jkasten2 commented on Jun 22, 2015

    @jkasten2
    Contributor

    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.

  4. stasix commented on Jun 22, 2015

    @stasix
    Author

    Great! Thanks!

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

    On Tue, Jun 23, 2015 at 12:33 AM, Josh Kasten notifications@github.com
    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)
    .

  5. added a commit that references this issue on Jun 23, 2015
  6. stasix commented on Jun 23, 2015

    @stasix
    Author

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

  7. jkasten2 commented on Jun 23, 2015

    @jkasten2
    Contributor

    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.

  8. stasix commented on Jun 25, 2015

    @stasix
    Author

    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.

  9. jkasten2 commented on Jun 26, 2015

    @jkasten2
    Contributor

    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.

  10. stasix commented on Jun 28, 2015

    @stasix
    Author

    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?

  11. jkasten2 commented on Jun 29, 2015

    @jkasten2
    Contributor

    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.

  12. stasix commented on Jul 9, 2015

    @stasix
    Author

    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?

  13. jkasten2 commented on Jul 9, 2015

    @jkasten2
    Contributor

    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.

  14. stasix commented on Jul 10, 2015

    @stasix
    Author

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

  15. added a commit that references this issue on Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions