Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

cq.mobile.application.pushNotificationToken is either undefined or null

Avatar

Level 1

Hello,

I'm trying to retriece the push notification token from Android and iOS (iPhone) devices in order to register to a third-party push notification platform. I checked the documentation provided by Adobe and it only states that I need to call cq.mobile.application.pushNotificationToken that this value would be already there. But when I use this, for Android I always get undefined (both emulator and real device) and for iOS it comes as null (only one device that I tested came with a base64 encoded value).

Are there extra configurations/plugins that I should enable for it to work?

Thanks in advance,

Alfredo Ferreira

EDIT: Adobe Doc AEM Mobile specific Cordova-enabled plug-ins

1 Accepted Solution

Avatar

Correct answer by
Level 1

UPDATE (Jan 11th 2017): Adobe fixed the issue on the 2017.1 (January 10) release. More info at: What's new in Experience Manager Mobile

Hi Andrei!

Thanks for the response. Yes, I have that enabled and actually contacted Adobe directly. Turns out there might be a bug for Android only. Even with a Google Cloud Messaging (GCM) account setup, the phone receives the push notification when sent through the GCM console but the token is not being retrieved through cq.mobile.application.pushNotificationToken

As pointers for future readers:
* Make sure you have "Enable Extensibility Features" on the articles that you need cordova working. Might be a good idea to set this enabled as default on project level (Edit Project, Content tab)

* Make sure to enable push notifications on Apple provision configuration

* Make sure to enable push notification on Android app generation, create a GCM project, download google-services.json and upload to AEM Mobile

* Make sure to allow push notifications when prompted on the app

As for the bug retrieving push notification token on Android, I'll update this question when I have more info.

View solution in original post

2 Replies

Avatar

Employee

Hi Alfredo,

Quick question : - Did you check the option "Enable Extensibility Features" when you have created your article ?

Does any of the cq.mobile API work for you ?

Undefined is usually when the above option is not checked.

Thanks,

Andrei P

Avatar

Correct answer by
Level 1

UPDATE (Jan 11th 2017): Adobe fixed the issue on the 2017.1 (January 10) release. More info at: What's new in Experience Manager Mobile

Hi Andrei!

Thanks for the response. Yes, I have that enabled and actually contacted Adobe directly. Turns out there might be a bug for Android only. Even with a Google Cloud Messaging (GCM) account setup, the phone receives the push notification when sent through the GCM console but the token is not being retrieved through cq.mobile.application.pushNotificationToken

As pointers for future readers:
* Make sure you have "Enable Extensibility Features" on the articles that you need cordova working. Might be a good idea to set this enabled as default on project level (Edit Project, Content tab)

* Make sure to enable push notifications on Apple provision configuration

* Make sure to enable push notification on Android app generation, create a GCM project, download google-services.json and upload to AEM Mobile

* Make sure to allow push notifications when prompted on the app

As for the bug retrieving push notification token on Android, I'll update this question when I have more info.