{ "id": "133728", "key": "AC-939", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2014-08-20T23:19:27.000+0000", "created": "2014-07-25T16:20:39.000+0000", "labels": [ "TCSupportTriage", "android", "exception", "pushnotification" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:37:15.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14550", "name": "Appcelerator Modules", "description": "Please enter tickets related to Modules here." } ], "description": "Push notifications work only when app is in focus. A force close error appear if they are received when the app is in the background. \r\n\r\nWhen the app is minimized the following stack trace is produced prior to running any app code. \r\n\r\n{code}\r\n[ERROR] : TiApplication: (main) [41,156900] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start receiver ti.cloudpush.GCMReceiver: java.lang.NullPointerException; Titanium 3.2.3,2014/04/22 10:17,b958a70\r\n[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start receiver ti.cloudpush.GCMReceiver: java.lang.NullPointerException\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2431)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.access$1500(ActivityThread.java:141)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)\r\n[ERROR] : TiApplication: \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[ERROR] : TiApplication: \tat android.os.Looper.loop(Looper.java:137)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.main(ActivityThread.java:5103)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invoke(Method.java:525)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)\r\n[ERROR] : TiApplication: \tat dalvik.system.NativeStart.main(Native Method)\r\n[ERROR] : TiApplication: Caused by: java.lang.NullPointerException\r\n[ERROR] : TiApplication: \tat org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)\r\n[ERROR] : TiApplication: \tat org.json.JSONTokener.nextValue(JSONTokener.java:94)\r\n[ERROR] : TiApplication: \tat org.json.JSONObject.(JSONObject.java:154)\r\n[ERROR] : TiApplication: \tat org.json.JSONObject.(JSONObject.java:171)\r\n[ERROR] : TiApplication: \tat ti.cloudpush.CloudpushModuleGeneric.showTrayNotification(CloudpushModuleGeneric.java:198)\r\n[ERROR] : TiApplication: \tat ti.cloudpush.CloudpushModuleGeneric.receivePayload(CloudpushModuleGeneric.java:96)\r\n[ERROR] : TiApplication: \tat ti.cloudpush.GCMReceiver.onReceive(GCMReceiver.java:26)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2424)\r\n[ERROR] : TiApplication: \t... 10 more\r\n[ERROR] : AndroidRuntime: FATAL EXCEPTION: main\r\n[ERROR] : AndroidRuntime: java.lang.RuntimeException: Unable to start receiver ti.cloudpush.GCMReceiver: java.lang.NullPointerException\r\n[ERROR] : AndroidRuntime: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2431)\r\n[ERROR] : AndroidRuntime: \tat android.app.ActivityThread.access$1500(ActivityThread.java:141)\r\n[ERROR] : AndroidRuntime: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)\r\n[ERROR] : AndroidRuntime: \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[ERROR] : AndroidRuntime: \tat android.os.Looper.loop(Looper.java:137)\r\n[ERROR] : AndroidRuntime: \tat android.app.ActivityThread.main(ActivityThread.java:5103)\r\n[ERROR] : AndroidRuntime: \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] : AndroidRuntime: \tat java.lang.reflect.Method.invoke(Method.java:525)\r\n[ERROR] : AndroidRuntime: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)\r\n[ERROR] : AndroidRuntime: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)\r\n[ERROR] : AndroidRuntime: \tat dalvik.system.NativeStart.main(Native Method)\r\n[ERROR] : AndroidRuntime: Caused by: java.lang.NullPointerException\r\n[ERROR] : AndroidRuntime: \tat org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)\r\n[ERROR] : AndroidRuntime: \tat org.json.JSONTokener.nextValue(JSONTokener.java:94)\r\n[ERROR] : AndroidRuntime: \tat org.json.JSONObject.(JSONObject.java:154)\r\n[ERROR] : AndroidRuntime: \tat org.json.JSONObject.(JSONObject.java:171)\r\n[ERROR] : AndroidRuntime: \tat ti.cloudpush.CloudpushModuleGeneric.showTrayNotification(CloudpushModuleGeneric.java:198)\r\n[ERROR] : AndroidRuntime: \tat ti.cloudpush.CloudpushModuleGeneric.receivePayload(CloudpushModuleGeneric.java:96)\r\n[ERROR] : AndroidRuntime: \tat ti.cloudpush.GCMReceiver.onReceive(GCMReceiver.java:26)\r\n[ERROR] : AndroidRuntime: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2424)\r\n[ERROR] : AndroidRuntime: \t... 10 more\r\n{code}\r\n\r\nCode used was a direct copy from:\r\nhttp://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.CloudPush\r\n\r\nAdditional notes, a stack overflow question is in progress on the issue. http://stackoverflow.com/questions/24857937/unable-to-receive-push-notifications-to-notifications-tray-on-appcelerator-andro ", "attachment": [], "flagged": false, "summary": "Android push notifications not working when app is out of focus - force close", "creator": { "name": "erobertshaw", "key": "erobertshaw", "displayName": "Edward Robertshaw", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "erobertshaw", "key": "erobertshaw", "displayName": "Edward Robertshaw", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "MacOSX 10.9.4\r\nTitanium Studio 3.3.0.201407100905\r\nti.cloudpush 3.2.1 and Titanium SDK 3.2.3.GA 3.3.0\r\nalso tried ti.cloudpush 3.3.0 and Titanium SDK 3.2.3.GA ", "comment": { "comments": [ { "id": "317066", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~erobertshaw]!\r\n\r\nCan you please try this test code and report back if you get the same results? TIA! Push notifications work when app is in focus and run in background. But push notifications not working when we stop the app by force from Manage application. \r\n\r\n \r\n*TESTING ENVIRONMENT:*\r\n Titanium SDK: 3.3.0.GA and 3.2.3.GA\r\n Titanium CLI: 3.3.0\r\n OS X Version: 10.9.3\r\n Android API Level: 17 and 19\r\n \r\n*STEPS TO REPRODUCE:*\r\n1. Create a classic Project.\r\n2. Paste the following gits code in app.js file and tiapp.xml file.\r\n3. Enable cloud and add module cloud and cloudpush.\r\n4. At Application Dashboard in setting option insert GCM API key and GCM Sender ID.\r\n5. Create user in development option that you will use for login.\r\n6. Run this code with testing environment.\r\n \r\n*TESTING CODE:*\r\n\r\n[https://gist.github.com/MotiurRahman/8766037]\r\n\r\n*TESTING RESULT:*\r\n\r\nPush notifications work when app is in focus and run in background.But push notifications not working when we stop the app by force from Manage application.\r\n", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-05T10:56:40.000+0000", "updated": "2014-08-07T02:09:10.000+0000" }, { "id": "319586", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Tested on 3.3.0.GA, works fine. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-20T23:19:27.000+0000", "updated": "2014-08-20T23:19:27.000+0000" }, { "id": "328157", "author": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "body": "I am also facing this issue on 3.3.0GA\r\n{code}\r\n[WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4161cba8)\r\n[ERROR] : TiApplication: (main) [132642,138481] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start receiver com.appcelerator.cloudpush.GCMReceiver: java.lang.NullPointerException; Titanium 3.3.0,2014/07/11 12:36,787cd39\r\n[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start receiver com.appcelerator.cloudpush.GCMReceiver: java.lang.NullPointerException\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2414)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.access$1700(ActivityThread.java:135)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)\r\n[ERROR] : TiApplication: \tat android.os.Handler.dispatchMessage(Handler.java:102)\r\n[ERROR] : TiApplication: \tat android.os.Looper.loop(Looper.java:136)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.main(ActivityThread.java:5001)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invoke(Method.java:515)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)\r\n[ERROR] : TiApplication: \tat dalvik.system.NativeStart.main(Native Method)\r\n[ERROR] : TiApplication: Caused by: java.lang.NullPointerException\r\n[ERROR] : TiApplication: \tat com.appcelerator.cloudpush.utils.APSProperties.(APSProperties.java:45)\r\n[ERROR] : TiApplication: \tat com.appcelerator.cloudpush.Settings.props(Settings.java:45)\r\n[ERROR] : TiApplication: \tat com.appcelerator.cloudpush.Settings.useSingleCallback(Settings.java:67)\r\n[ERROR] : TiApplication: \tat com.appcelerator.cloudpush.APSCloudPush.receivePayload(APSCloudPush.java:229)\r\n[ERROR] : TiApplication: \tat com.appcelerator.cloudpush.GCMReceiver.onReceive(GCMReceiver.java:31)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2407)\r\n[ERROR] : TiApplication: \t... 10 more\r\n[INFO] : Process: Sending signal. PID: 4816 SIG: 9\r\n{code}", "updateAuthor": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "created": "2014-10-15T10:37:25.000+0000", "updated": "2014-10-15T10:37:25.000+0000" }, { "id": "328318", "author": { "name": "pastuxso", "key": "pastuxso", "displayName": "Cristian Cepeda", "active": true, "timeZone": "America/Bogota" }, "body": "I have the same problem, this is an adb log\r\n\r\n{{monospaced}}\r\nE/TiApplication( 5409): (main) [25,656] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start receiver com.appcelerator.cloudpush.GCMReceiver: java.lang.NullPointerException; Titanium 3.3.0,2014/07/11 12:36,787cd39\r\nE/TiApplication( 5409): java.lang.RuntimeException: Unable to start receiver com.appcelerator.cloudpush.GCMReceiver: java.lang.NullPointerException\r\nE/TiApplication( 5409): \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2441)\r\nE/TiApplication( 5409): \tat android.app.ActivityThread.access$1700(ActivityThread.java:139)\r\nE/TiApplication( 5409): \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)\r\nE/TiApplication( 5409): \tat android.os.Handler.dispatchMessage(Handler.java:102)\r\nE/TiApplication( 5409): \tat android.os.Looper.loop(Looper.java:136)\r\nE/TiApplication( 5409): \tat android.app.ActivityThread.main(ActivityThread.java:5086)\r\nE/TiApplication( 5409): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/TiApplication( 5409): \tat java.lang.reflect.Method.invoke(Method.java:515)\r\nE/TiApplication( 5409): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)\r\nE/TiApplication( 5409): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)\r\nE/TiApplication( 5409): \tat dalvik.system.NativeStart.main(Native Method)\r\nE/TiApplication( 5409): Caused by: java.lang.NullPointerException\r\nE/TiApplication( 5409): \tat com.appcelerator.cloudpush.utils.APSProperties.(APSProperties.java:45)\r\nE/TiApplication( 5409): \tat com.appcelerator.cloudpush.Settings.props(Settings.java:45)\r\nE/TiApplication( 5409): \tat com.appcelerator.cloudpush.Settings.useSingleCallback(Settings.java:67)\r\nE/TiApplication( 5409): \tat com.appcelerator.cloudpush.APSCloudPush.receivePayload(APSCloudPush.java:229)\r\nE/TiApplication( 5409): \tat com.appcelerator.cloudpush.GCMReceiver.onReceive(GCMReceiver.java:31)\r\nE/TiApplication( 5409): \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2434)\r\nE/TiApplication( 5409): \t... 10 more\r\n{{monospaced}}", "updateAuthor": { "name": "pastuxso", "key": "pastuxso", "displayName": "Cristian Cepeda", "active": true, "timeZone": "America/Bogota" }, "created": "2014-10-16T14:06:01.000+0000", "updated": "2014-10-16T14:06:01.000+0000" }, { "id": "328319", "author": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "body": "feels good im not the only one facing this, and what bothers me is that it used to work perfectly and now it is not, it's not easy to explain for the customer.", "updateAuthor": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "created": "2014-10-16T14:08:16.000+0000", "updated": "2014-10-16T14:08:16.000+0000" }, { "id": "328456", "author": { "name": "OlliM", "key": "ollim", "displayName": "Oliver Milanovic", "active": true, "timeZone": "Europe/Berlin" }, "body": "I have the same issue here with 3.4.0GA on a Nexus 5 with Android 4.4.4 running on it:\r\n\r\n{{monospaced}}\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): java.lang.RuntimeException: Unable to start receiver com.appcelerator.cloudpush.GCMReceiver: java.lang.NullPointerException\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2414)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.app.ActivityThread.access$1700(ActivityThread.java:135)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.os.Handler.dispatchMessage(Handler.java:102)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.os.Looper.loop(Looper.java:136)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.app.ActivityThread.main(ActivityThread.java:5001)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat java.lang.reflect.Method.invoke(Method.java:515)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat dalvik.system.NativeStart.main(Native Method)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): Caused by: java.lang.NullPointerException\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.appcelerator.cloudpush.utils.APSProperties.(APSProperties.java:45)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.appcelerator.cloudpush.Settings.props(Settings.java:45)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.appcelerator.cloudpush.Settings.useSingleCallback(Settings.java:67)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.appcelerator.cloudpush.APSCloudPush.receivePayload(APSCloudPush.java:229)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat com.appcelerator.cloudpush.GCMReceiver.onReceive(GCMReceiver.java:31)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \tat android.app.ActivityThread.handleReceiver(ActivityThread.java:2407)\r\n10-17 16:01:04.880: E/AndroidRuntime(30682): \t... 10 more", "updateAuthor": { "name": "OlliM", "key": "ollim", "displayName": "Oliver Milanovic", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-10-17T14:13:57.000+0000", "updated": "2014-10-17T14:13:57.000+0000" }, { "id": "328459", "author": { "name": "OlliM", "key": "ollim", "displayName": "Oliver Milanovic", "active": true, "timeZone": "Europe/Berlin" }, "body": "I'd like to add to my comment, that I'm using Alloy, if that helps...", "updateAuthor": { "name": "OlliM", "key": "ollim", "displayName": "Oliver Milanovic", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-10-17T14:23:40.000+0000", "updated": "2014-10-17T14:23:40.000+0000" }, { "id": "330055", "author": { "name": "cerw", "key": "cerw", "displayName": "Petr Cervenka", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Same issue here on Nexus 5 running Android L + SDK 3.4.0GM\r\n", "updateAuthor": { "name": "cerw", "key": "cerw", "displayName": "Petr Cervenka", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2014-10-30T06:36:44.000+0000", "updated": "2014-10-30T06:36:44.000+0000" }, { "id": "331248", "author": { "name": "davidfischer", "key": "davidfischer", "displayName": "David Fischer", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "davidfischer", "key": "davidfischer", "displayName": "David Fischer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-11-07T22:18:17.000+0000", "updated": "2014-11-07T22:18:17.000+0000" }, { "id": "331286", "author": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "body": "In my case downgrading ti.cloudpush 3.2.1 fixed the issue completely, app no longer crash when in foreground, background and when terminated.", "updateAuthor": { "name": "fouadkada", "key": "fouadkada", "displayName": "Fouad Kada", "active": true, "timeZone": "Asia/Beirut" }, "created": "2014-11-08T08:20:44.000+0000", "updated": "2014-11-08T08:20:44.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }