{ "id": "128270", "key": "TIMOB-16744", "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": null, "resolutiondate": null, "created": "2014-03-27T06:56:27.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" }, { "id": "15857", "description": "Release 3.2.2", "name": "Release 3.2.2", "archived": false, "released": true, "releaseDate": "2014-03-09" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:04:06.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "13617", "name": "Cloud", "description": "Cloud/CloudPush and related items" } ], "description": "h2. Description\r\nEven if CloudPush.enabled property is set to false, I am still able to receive push notification. Instead i have to unsubscribe from channel to really disable push notification for that channel.\r\n\r\nh2. Test case\r\n{code}\r\nvar CloudPush = require('ti.cloudpush');\r\nvar deviceToken = null;\r\n \r\n// Initialize the module\r\nCloudPush.retrieveDeviceToken({\r\n success: deviceTokenSuccess,\r\n error: deviceTokenError\r\n});\r\n\r\n// Enable push notifications for this device\r\n// Save the device token for subsequent API calls\r\nfunction deviceTokenSuccess(e) {\r\n CloudPush.enabled = false; // TO STOP RECEIVING PUSH NOTIFICATION\r\n deviceToken = e.deviceToken;\r\n subscribeToChannel();\r\n}\r\n\r\nvar Cloud = require(\"ti.cloud\");\r\nfunction subscribeToChannel () {\r\n // Subscribes the device to the 'test' channel\r\n // Specify the push type as either 'android' for Android or 'ios' for iOS\r\n Cloud.PushNotifications.subscribeToken({\r\n device_token: deviceToken,\r\n channel: 'test',\r\n type: Ti.Platform.name == 'android' ? 'android' : 'ios'\r\n }, function (e) {\r\n if (e.success) {\r\n alert('Subscribed');\r\n } else {\r\n alert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n }\r\n });\r\n}\r\n\r\n\r\n\r\nfunction deviceTokenError(e) {\r\n alert('Failed to register for push notifications! ' + e.error);\r\n}\r\n \r\n// Process incoming push notifications\r\nCloudPush.addEventListener('callback', function (evt) {\r\n alert(evt.payload);\r\n});\r\n// Triggered when the push notifications is in the tray when the app is not running\r\nCloudPush.addEventListener('trayClickLaunchedApp', function (evt) {\r\n Ti.API.info('Tray Click Launched App (app was not running)');\r\n});\r\n// Triggered when the push notifications is in the tray when the app is running\r\nCloudPush.addEventListener('trayClickFocusedApp', function (evt) {\r\n Ti.API.info('Tray Click Focused App (app was already running)');\r\n});\r\n{code}", "attachment": [], "flagged": false, "summary": "Android:Receiving push notification even if cloudPush.enabled is set to false", "creator": { "name": "rsharma", "key": "rsharma", "displayName": "Rupesh Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rsharma", "key": "rsharma", "displayName": "Rupesh Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android : 4.1.2\r\nDevice : LG\r\nSDK : 3.2.2, 3.2.1, 3.2.0\r\nMac : 10.9.2", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }