Application type: mobile Titanium SDK: 3.2.0.GA Device: Android device Host Operating System: Mac OSX 10.8.5 Titanium Studio, build: 3.2.1.201402041146
I've got one problem when I try to retrive the device token in an Android App with this code
if (Ti.Platform.osname == "android") { var CloudPush = require('ti.cloudpush'); CloudPush.debug = true; CloudPush.showTrayNotificationsWhenFocused = true; CloudPush.focusAppOnPush = false; var deviceToken; var Cloud = require('ti.cloud'); Cloud.debug = true; //when the app arrives here there's the crash CloudPush.retrieveDeviceToken({ success : function deviceTokenSuccess(e) { deviceToken = e.deviceToken; } }); }when I launch the app it crashes with this message in console
[ERROR] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. [ERROR] : TiApplication: (AsyncTask #1) [40783,47257] Sending event: exception on thread: AsyncTask #1 msg:java.lang.RuntimeException: An error occured while executing doInBackground(); Titanium 3.2.0,2013/12/20 10:57,d9182d6 [ERROR] : TiApplication: java.lang.RuntimeException: An error occured while executing doInBackground() [ERROR] : TiApplication: at android.os.AsyncTask$3.done(AsyncTask.java:300) [ERROR] : TiApplication: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) [ERROR] : TiApplication: at java.util.concurrent.FutureTask.setException(FutureTask.java:222) [ERROR] : TiApplication: at java.util.concurrent.FutureTask.run(FutureTask.java:242) [ERROR] : TiApplication: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) [ERROR] : TiApplication: at java.lang.Thread.run(Thread.java:811) [ERROR] : TiApplication: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void org.appcelerator.kroll.KrollFunction.callAsync(org.appcelerator.kroll.KrollObject, java.util.HashMap)' on a null object reference [ERROR] : TiApplication: at ti.cloudpush.CloudpushModuleGeneric$1$1.failedReceiveDeviceToken(CloudpushModuleGeneric.java:622) [ERROR] : TiApplication: at com.appcelerator.cloud.push.CCPushService.registerGCMService(CCPushService.java:334) [ERROR] : TiApplication: at com.appcelerator.cloud.push.CCPushService.registerGCM(CCPushService.java:280) [ERROR] : TiApplication: at ti.cloudpush.CloudpushModuleGeneric$1.receivedGCMSenderId(CloudpushModuleGeneric.java:609) [ERROR] : TiApplication: at com.appcelerator.cloud.push.CCPushService$1.doInBackground(CCPushService.java:91) [ERROR] : TiApplication: at com.appcelerator.cloud.push.CCPushService$1.doInBackground(CCPushService.java:85) [ERROR] : TiApplication: at android.os.AsyncTask$2.call(AsyncTask.java:288) [ERROR] : TiApplication: at java.util.concurrent.FutureTask.run(FutureTask.java:237) [ERROR] : TiApplication: ... 4 moreI used the code above in other application that I've done in the past and there weren't problems. I already set in tiapp.xml to use GCM, and I downloaded Google Play Services in the android sdk.
Thanks, Alberto