We have Cordova Android/iOS apps. On iOS, we're using XCode 10 and targeting iOS 10, and we use the urbanairship-cordova plugin. There is a quirk I am struggling with on iOS.

When I log into the app my named user is set in Airship. The device shows up fine on device lookup, and appears as opted out for notifications. Thats fine, because we have a preferences page where the user can enable mobile notifications. On that page, we use the `setUserNotificationsEnabled` method of the cordova plugin to update the enabled value. Calling this method brings up the native prompt to allow notifications. Once the user allows notifications, we receive the `notification_opt_in_status` document event, but back in the Airship device lookup dashboard the device is still listed as opted out.

We notice that if we close and reopen the app at this point, the device is marked as opted-in and we can push notifications as normal. This is only an issue on iOS.

Here are the logs from a first app run right after a fresh installation. All i did during this run was open the app, log in, enable notifications, and close the app. My device was successfully registered on Airship (Dev Project), but the device was not opted in even though I enabled notifications.

Here are the logs for the very next run. By the time the app finishes loading, my device is marked as opted-in on the Airship dashboard

Note: Any lines that contain "[URBAN AIRSHIP]" are debugging lines added by us. I replaced our actual Development API Key with "[DEVELOPMENT API KEY]" placeholder everywhere in the logs.


Didn't find what you were looking for?

New post



  • Hi Mike,

    My name is Darragh, one of the Technical Support Engineers at Airship. Thanks for posting in our forums.

    Once you trigger the opt-in function from within your application and if you perform something else, such as navigate around your application, before closing the app, does your application opt-in?

    It may not be calling updateResgistration immediately so performing any kind of action with your application after you have triggered the opt-in function to fire may solve your issue. The reason it works when you launch your application because we always fire channel registration on launch.

    Two things I have observed from your logs: 

    Not opted-in: 

    2019-04-18 10:46:07.820758-0400 Respage[1254:326843] [T] -[UAAnalytics addEvent:]_block_invoke [Line 208] Event added: UAEvent ID: FBE72F91-4608-4594-AB89-C1010EBCBA36 type: device_registration time: 1555598767.811680 data: {

    Successfully opted-in:

    2019-04-18 10:52:16.975381-0400 Respage[1264:328363] [T] -[UAAnalytics addEvent:]_block_invoke [Line 208] Event added: UAEvent ID: 1BB1EEDD-5EF9-418F-B2D6-D73EBE80C9C8 type: device_registration time: 1555599136.944781 data: {
        "channel_id" = "20eff322-31d6-4b50-9e71-55efed239022";
        "device_token" = 1b261bb163794b049d376439f1cab64d1771614698f389db1824b12afe7a5502;

    Let me know how your testing goes.

    Kind regards,
    Darragh Blake
    Technical Support Engineer

    Portland | San Francisco | London | Paris | New York | New Delhi

    Comment actions Permalink
  • We have the same problem with native iOS SDK. Some random devices are `opt-out` at App install and won't `opt-in` even after a while and even when we were trying to enable/disable the property `isDataCollectionEnabled` multiple times. The device will `opt-in` only after killing the app and doing a new cold restart.

    We did a workaround by re-register Airship a few seconds after the first registration. It works, but still it's a workaround and would be better if the issue is fixed in the SDK.

    Comment actions Permalink

Please sign in to leave a comment.