Register Device for Push Notifications Using Corona SDK

0 votes
Hi, There are many APIs in the push notification service that use the device token (subscribe, unsubscribe, store device token, etc). My question is how do I get the device token to begin with? I understand that you must register your device with GCM/Firebase to receive the device token but what I do not understand is where that happens. What API within App42 actually registers the device with GCM and receives the device token? Thanks ahead of time! Scott
asked May 18, 2017 in Corona by gsglawson (10 points)

1 Answer

0 votes
Hi Gsglawson,

 

Please follow this(http://blogs.shephertz.com/2014/01/24/making-turn-based-game-using-app42-corona-sdk/ ) link to understand that how device register to GCM for push notification and get the token which you will send to App42.

Let us know if you find any difficulty in integrating or needing any help from our side.  

 

Regards,

Himanshu Sharma
answered May 18, 2017 by hs00105 (2,005 points)
edited May 19, 2017 by hs00105
For future readers, Google GCM and FCM only give the device token out at specific times; the first time the app is ran, after an uninstall/reinstall and after the user clears the app data. You will receive an event.type of "remoteRegistration." The token itself will be stored in "event.token." Since you cannot seem to programmatically request a new token via Corona, I found it best to not only register this token with App42(pushService:storeDeviceToken) but to also store it locally in case the user logs out or unsubscribes or manages to delete the token from App42.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...