[AC-591] DeviceToken null on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2016-02-07T05:52:31.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Swapnil Singh |
Assignee | Shak Hossain |
Created | 2016-02-01T10:14:42.000+0000 |
Updated | 2016-02-07T05:52:31.000+0000 |
Description
Hello,
Using Ti.cloudpush module i m able to retrieve devicetoken on android,
but sometimes the devicetoken returned is null,
when i re-install the app, it successfully returns a devicetoken
In which device you are trying? Try the below code
The code is self-explanatory. Create a user in your arrowDB in the platform and provide the email and pass in loginDefault(). First login and then subscribe the device and send push notification. Thanks.
The code applied is same as mentioned in Appcelerator Documentation: // Require the module var CloudPush = require('ti.cloudpush'); var deviceToken = null; // Initialize the module CloudPush.retrieveDeviceToken({ success : deviceTokenSuccess, error : deviceTokenError }); // Enable push notifications for this device // Save the device token for subsequent API calls function deviceTokenSuccess(e) { deviceToken = e.deviceToken; //alert(deviceToken); } function deviceTokenError(e) { //alert('Failed to register for push notifications! ' + e.error); } // Process incoming push notifications CloudPush.addEventListener('callback', function(evt) { Ti.API.info("NOTIFICATION :" + JSON.stringify(evt)); }); And we r using AWS SNS for sending push notifications to the device
What device you are generating the issue. Give us the model number. Also, make sure you use ti.cloudpush 3.4.1 module version.
I see to the ti.cloudpush version, whereas i have been facing this issue on Motorola G3 series phones for now