{ "id": "150072", "key": "TIMOB-20285", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-30T07:08:47.000+0000", "created": "2015-07-31T19:57:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [ { "id": "50021", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "150589", "key": "AC-310", "fields": { "summary": "Android - CloudPush - callback is called but notification isn't cleared", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2017-03-31T22:18:51.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "My setup is like the following:\r\n\r\n{code}\r\n\tvar CloudPush = require('ti.cloudpush');\r\n\tvar rc = CloudPush.isGooglePlayServicesAvailable();\r\n\tif(rc == CloudPush.SUCCESS){\r\n\t\tCloudPush.retrieveDeviceToken({\r\n\t\t success: deviceTokenSuccess,\r\n\t\t error: function(){}\r\n\t\t});\r\n\t\tCloudPush.addEventListener('trayClickLaunchedApp', handler1);\r\n\t\tCloudPush.addEventListener('trayClickFocusedApp', handler2);\r\n\t\tCloudPush.addEventListener('callback', handler3);\r\n\t}\r\n{code}\r\n\r\ntiapp.xml\r\n{code}\r\n You have $number$ unread messages\r\n{code}\r\n\r\nIf I receive a notification but leave it there without clicking it. Instead I launch my app from launcher. Then the callback function is called but the notification isn't cleared. If later I click the notification, it will launch the app but no callback is called.\r\n\r\nThis is confusing to users. Preferable behavior would be: Once the callback is called, the corresponding notification should be cleared and the group message number should be reset.\r\n\r\nOr, like the iOS, the callback should never be called unless users click the notification or the app is in the foreground.", "attachment": [], "flagged": false, "summary": "Android - CloudPush - callback is called but notification isn't cleared", "creator": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "SDK 5.1.2/Android 5.X, 6.X", "closedSprints": [ { "id": 614, "state": "closed", "name": "2016 Sprint 07 SDK", "startDate": "2016-03-26T00:38:56.432Z", "endDate": "2016-04-09T00:38:00.000Z", "completeDate": "2016-04-11T04:41:08.231Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "360603", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Please re-open this case. I tested it again using your test case. The notification isn't cleared.\r\n\r\nTo test it, you can't click the notification. Instead, launch the app from launcher. Then the callback is called, but the notification isn't cleared.\r\n\r\nI test it on my device - HTC One M7 - Android 5.0.2", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-21T00:55:05.000+0000", "updated": "2015-08-21T00:55:05.000+0000" }, { "id": "375340", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tested again on Nexus 7, Android 6.0. I can still re-produce the issue. Please re-open this ticket. Maybe include a video or detailed steps on how you test it, so that we can make sure we are on the same page. Thanks!", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-27T02:53:39.000+0000", "updated": "2016-01-27T02:53:39.000+0000" }, { "id": "377961", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~shawnlan],\r\n\r\nThis is as per expected behaviour as mentioned in {{callback}} event documentation https://docs.appcelerator.com/platform/latest/#!/api/Modules.CloudPush-event-callback\r\n\r\nThe notifications are not cleared in {{callback}} event because this event is fired on receiving a push, but not on user interaction.\r\nAlso the docs says {{This will only be fired once per push notification.}} This is the reason the {{callback}} event will not be fired on next app open.\r\n\r\nBut notification will be cleared either in {{trayClickFocusedApp}} or {{trayClickLaunchedApp}} events respecting the clear flag {{FLAG_AUTO_CANCEL}} mentioned in the notification. These events are fired when User clicks on your app's notifications. To handle graciously, you may want to invoke your notification handling logic in these methods as well.\r\n\r\nSo I don't see this as a bug. That being said, I understand that clearing handled notifications should be unambiguous. You can open a feature request to provide an API to clear a particular notification or all notifications. ", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-26T05:57:02.000+0000", "updated": "2016-02-26T08:36:37.000+0000" }, { "id": "377963", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "\"The notifications are not cleared in callback event because this event is fired on receiving a push, but not on user interaction. \r\nAlso the docs says This will only be fired once per push notification. This is the reason the callback event will not be fired on next app open.\"\r\n\r\nWell, the expected behavior should be:\r\n\r\nThe callback shouldn't be called if the user doesn't interact with the notification. Or, when the user interacts with the notification, the callback should be called again. Or, when the user interacts with the notification, the trayClick events should contain the payload.\r\n\r\nI would say it's a bug from user experience perspective.", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-26T06:44:24.000+0000", "updated": "2016-02-26T20:07:22.000+0000" }, { "id": "378009", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I found that if singleCallback is set to true, then when launching the app, the callback isn't called. Well, that can solve the issue here.\r\n\r\nBut is this the expected behavior? It isn't in the documentation. Will it not be changed in the future?\r\n\r\nThanks.", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-26T20:03:00.000+0000", "updated": "2016-02-26T20:03:00.000+0000" }, { "id": "378101", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "Actually the purpose of {{callback}} event is well defined. It is used to inform that the app received a push. This behaviour can be effected by combination of flags like {{focusAppOnPush}}. See https://docs.appcelerator.com/platform/latest/#!/api/Modules.CloudPush-event-callback\r\n\r\nThe trayClick events indeed contain the payload. \r\nAlso what are the other flags you are using with CloudPush ?\r\n\r\n\r\n", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-29T03:54:24.000+0000", "updated": "2016-02-29T03:54:24.000+0000" }, { "id": "378187", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yeah the problem is that the trayClick events don't contain the payload. At least not in the documentation. So I have to use the \"callback\" to show the message.\r\n\r\nWhat about my last question? When singleCallback set to true, the callback isn't called when launching the app from the drawer? It is not in the documentation either.", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-29T20:29:49.000+0000", "updated": "2016-02-29T20:53:20.000+0000" }, { "id": "378752", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~shawnlan]\r\n\r\n{{trayClick*}} events contains payload. We need to update docs accordingly. \r\n{code}\r\nTi.API.info('Tray Click Focused App (app was already running)' + JSON.stringify(evt));\r\n{\"type\":\"trayClickFocusedApp\",\"source\":{\"pushType\":\"gcm\",\"invocationAPIs\":[],\"bubbleParent\":true,\"showTrayNotification\":true,\"enabled\":false,\"__propertiesDefined__\":true,\"singleCallback\":false,\"_events\":{\"callback\":{},\"trayClickFocusedApp\":{}},\"focusAppOnPush\":false,\"debug\":true,\"showAppOnTrayClick\":true,\"showTrayNotificationsWhenFocused\":false,\"apiName\":\"Ti.Module\"},\"payload\":\"{\\\"android\\\":{\\\"icon\\\":\\\"app_icon\\\",\\\"sound\\\":\\\"default\\\",\\\"alert\\\":\\\"Push Notification Test\\\",\\\"badge\\\":2}}\",\"bubbles\":false,\"cancelBubble\":false}\r\n{code}\r\n\r\nTo invoke {{callback}} when app is launched you can set {{showTrayNotification}} to false. Please read this through before configuring your requirement https://docs.appcelerator.com/platform/latest/#!/api/Modules.CloudPush-event-callback\r\nThis should not be effected by {{singleCallback}}", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-04T09:25:42.000+0000", "updated": "2016-03-04T09:25:42.000+0000" }, { "id": "380021", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Then update the docs, please.\r\n\r\nHere is my setup:\r\n\r\n{code}\r\nvar CloudPush = require('ti.cloudpush');\r\n\tvar rc = CloudPush.isGooglePlayServicesAvailable();\r\n\tif(rc == CloudPush.SUCCESS){\r\n\t\t//CloudPush.singleCallback = true;\r\n\t\tCloudPush.retrieveDeviceToken({\r\n\t\t success: deviceTokenSuccess,\r\n\t\t error: function(){}\r\n\t\t});\r\n\t\tCloudPush.addEventListener('callback', receivePush);\r\n\t}\r\n{code}\r\n\r\nLaunching the app without clicking the notification will fire the callback, as described in the original post. If setting CloudPush.singleCallback to true, launching the app without clicking the notification will NOT fire the callback. Test it yourself and see.\r\n\r\nI've read through the docs several times, but it seems your docs is not clear and complete.", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-17T19:39:12.000+0000", "updated": "2016-03-17T19:39:12.000+0000" }, { "id": "380592", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~shawnlan] did you try setting {{showTrayNotification}} to false. \r\n", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-24T09:30:00.000+0000", "updated": "2016-03-24T09:32:40.000+0000" }, { "id": "380593", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR for docs change https://github.com/appcelerator/titanium_mobile/pull/7880", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-24T09:31:42.000+0000", "updated": "2016-03-24T09:31:42.000+0000" }, { "id": "380629", "author": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks.\r\n\r\nI didn't try to set {{showTrayNotification}} to false. I didn't want that.\r\n\r\nCheck my previous code. That's all my setup.", "updateAuthor": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-24T16:52:17.000+0000", "updated": "2016-03-24T16:52:17.000+0000" }, { "id": "381009", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Docs for PR merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-30T07:07:56.000+0000", "updated": "2016-03-30T07:07:56.000+0000" }, { "id": "381011", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~shawnlan] Is this still an issue?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-30T07:11:13.000+0000", "updated": "2016-03-30T07:11:13.000+0000" }, { "id": "414756", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~shawnlan] Hi Shawn, I'm just wondering if you are still experiencing this issue? If not, would you like me to close the ticket?", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T16:55:12.000+0000", "updated": "2017-03-22T16:55:12.000+0000" }, { "id": "416580", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed, if there are any problems, please file a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-31T22:18:51.000+0000", "updated": "2017-03-31T22:18:51.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }