{ "id": "170339", "key": "TIMOB-25521", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2017-11-18T02:06:56.000+0000", "created": "2017-11-16T12:12:19.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [ { "id": "56158", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "170280", "key": "TIMOB-25501", "fields": { "summary": "Android: App crash on receiving notification if app in background", "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" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "updated": "2017-11-18T02:06:56.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": [], "description": "*Note:* This error occurs only on google pixel device, running android 8.0.0\r\n\r\n*Issue Description:*\r\nWhen my app is closed or in the background and I am sending push notification through appcelerator dasboard, I get the error below. I am only getting this error on one device. The other device I am testing with does not have any errors.\r\n\r\n*Error Log:*\r\n{code}\r\n[ERROR] : [Pixel] BroadcastReceiver: BroadcastReceiver trying to return result during a non-ordered broadcast\r\n[ERROR] : [Pixel] BroadcastReceiver: java.lang.RuntimeException: BroadcastReceiver trying to return result during a non-ordered broadcast\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.content.BroadcastReceiver.checkSynchronousHint(BroadcastReceiver.java:649)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.content.BroadcastReceiver.setResultCode(BroadcastReceiver.java:415)\r\n[ERROR] : [Pixel] BroadcastReceiver: at com.appcelerator.aps.GCMReceiver.onReceive(GCMReceiver.java:32)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3252)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.app.ActivityThread.-wrap17(Unknown Source:0)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.os.Handler.dispatchMessage(Handler.java:105)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.os.Looper.loop(Looper.java:164)\r\n[ERROR] : [Pixel] BroadcastReceiver: at android.app.ActivityThread.main(ActivityThread.java:6541)\r\n[ERROR] : [Pixel] BroadcastReceiver: at java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] : [Pixel] BroadcastReceiver: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)\r\n[ERROR] : [Pixel] BroadcastReceiver: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)\r\n{code}\r\n\r\n*Steps to reproduce: (As per client)*\r\n\r\nWhen the app is started up the device token gets registered and stored. \r\nWhen clicking on the button, the device token is used to subscribe them to the channel which is made by providing some data (testing has been done using channel name 2_1). \r\nI can confirm that the device token is being registered and stored correctly and the device is successfully subscribing to the channel.\r\n\r\nUsing Axway dashboard mobile backend services of this app, I am sending through push notifications to all devices subscribed to channel 2_1. \r\n\r\nWhen the app is open and running on the device, an alert is shown displaying the notification payload.\r\n\r\n*However when the app is not open at all or is running in the background, the device should receive a push notification. It is at this point that the error is shown in the console log and no push notification is displayed on the device. All other testing devices are displaying the push notifications as expected at this point*\r\n\r\n*Test Code:*\r\n*Alloy.js*\r\nfunction processPushNotifications(e) {\r\nconsole.log(\"running processPushNotifications \");\r\nalert('Received push: ' + JSON.stringify(e));\r\n}//function\r\n\r\nfunction processDeviceToken(deviceToken){\r\nif (null != deviceToken) {\r\nconsole.log(\"saving device token\");\r\nTi.App.Properties.setString('deviceToken', deviceToken);\r\n} else {\r\nconsole.log(\"NO DEVICE TOKEN!!\");\r\n}//if\r\n}//function\r\n\r\nvar iiFunctions = require('iceberg/ii-functions');\r\n\r\nif (OS_ANDROID){\r\nconsole.log(\"running iiRegisterDeviceToken\");\r\niiFunctions.iiRegisterDeviceToken(processDeviceToken, processPushNotifications);\r\n\r\n} else if (OS_IOS) {\r\n\r\nvar arrConfig = [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE];\r\nconsole.log(\"running iiRegisterDeviceToken\");\r\niiFunctions.iiRegisterDeviceToken(processDeviceToken, processPushNotifications, arrConfig);\r\n}\r\n\r\n*iifunctions.js*\r\n{code}\r\nexports.iiRegisterDeviceToken = function(callback, pushNotificationsCallback, arrTypes) {\r\n\r\nif (OS_ANDROID) {\r\n\r\nvar CloudPush = require('ti.cloudpush');\t\r\n\r\n//Initialise the module\r\nconsole.log(\"retrieving device token\");\r\nCloudPush.retrieveDeviceToken({\r\nsuccess: function(e) {\r\nconsole.log(\"*********\");\r\nconsole.log(\"success\");\r\nconsole.log(\"*********\");\r\ncallback(e.deviceToken);\r\n\r\n}//function\r\n,error: function(e){\r\nconsole.log(\"*********\");\r\nconsole.log(\"error\");\r\nconsole.log(\"*********\");\r\nconsole.log(e.error);\r\n}//function\r\n});\r\n\r\n//Process incoming push notifications\r\nif ('undefined' != typeof pushNotificationsCallback) {\r\nCloudPush.addEventListener('callback', function(evt) {\r\nconsole.log(\"recieved notification, running callback\");\r\npushNotificationsCallback(evt.payload);\r\n});\r\n}//if\r\n\r\n} else if (OS_IOS) { \r\n\r\n//Check if the device is running iOS 8 or later\r\nif (parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) {\r\nconsole.log(\"greater than ios 8\");\r\n//Wait for user settings to be registered before registering for push notifications\r\nTi.App.iOS.addEventListener('usernotificationsettings', function registerForPush() {\r\n\r\n//Remove event listener once registered for push notifications\r\nTi.App.iOS.removeEventListener('usernotificationsettings', registerForPush); \r\n\r\nTi.Network.registerForPushNotifications({\r\nsuccess: function(e) {\r\nconsole.log(\"success\");\r\ncallback(e.deviceToken);\r\n}//function\r\n,callback: function(e) {\r\npushNotificationsCallback(e);\r\n}//function\r\n});\r\n\r\n});\r\n\r\n// Register notification types to use\r\nTi.App.iOS.registerUserNotificationSettings({\r\ntypes: arrTypes\r\n});\r\nconsole.log(\"set types\");\r\n\r\n} else {\r\nconsole.log(\"less than 8\");\r\nTi.Network.registerForPushNotifications({\r\ntypes: arrTypes\r\n,success: function(e) {\r\nconsole.log(\"success\");\r\ncallback(e.deviceToken);\r\n}//function\r\n,callback: function(e) {\r\npushNotificationsCallback(e);\r\n}//function\r\n});\r\n\r\n}//if\r\n\r\n}//if\r\n\r\n};\r\nvar deviceToken = Ti.App.Properties.getString('deviceToken');\r\n\r\nif (null !== deviceToken){\r\n\r\nvar Cloud = require(\"ti.cloud\");\r\nvar channelName = functions.makeChannelName(callbackParams.schoolId, callbackParams.yearGroupId);\r\n\r\nCloud.PushNotifications.subscribeToken({\r\ndevice_token: deviceToken,\r\nchannel: channelName,\r\ntype: Ti.Platform.name == 'android' ? 'android' : 'ios'\r\n}, function (e) {\r\nif (e.success) {\r\nconsole.log(\"subscribed to channel \" + channelName);\r\n} else {\r\nconsole.log('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n}//if\r\n});\r\n\r\n} else {\r\nconsole.log(\"No device token available\");\r\n}//if\r\n{code}\r\n\r\n*functions.js*\r\n{code}\r\nexports.makeChannelName = function(schoolId, intYearGroupId) {\r\nconsole.log(\"4 = \" + schoolId);\r\nreturn (schoolId + '_' + intYearGroupId).trim();\r\n\r\n};\r\n{code}\r\n\r\n*Expected:*\r\nPush notification should be received without any error.\r\n\r\n*Actual:*\r\nError occurs when receiving the notification\r\n\r\n", "attachment": [], "flagged": false, "summary": "ERROR : [Pixel] BroadcastReceiver: java.lang.RuntimeException: BroadcastReceiver trying to return result during a non-ordered broadcast", "creator": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "environment": "Ti SDK : 6.3.0.GA\r\nPhysical Device: google pixel device, running android 8.0.0\r\nRecent versions of cloud and cloudpush", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }