{ "id": "142017", "key": "TIMOB-18282", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2019-12-10T20:55:42.000+0000", "created": "2014-12-22T11:02:53.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "qe-3.5.0", "supportTeam" ], "versions": [ { "id": "16676", "description": "Release 3.4.1", "name": "Release 3.4.1", "archived": false, "released": true, "releaseDate": "2014-11-14" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-12-10T20:55:42.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Hi,\r\nI am using the registerForPushNotifications in my app. I get a push notification properly.\r\nThere are three situations:\r\n1. App is already opened.\r\n2. App is closed and I get a notification in Notification center. I open the app by clicking on notification.\r\n3. App is closed and I get a notification in Notification center. In this case I don't click on the notification and open the app from the app drawer by clicking on the app icon.\r\nIn the first two steps the callback function gets called, but in the third step, it is not being called.\r\n\r\nh3. Testing Environment: \r\nTitanium SDK: 3.4.1\r\nTitanium CLI: 3.4.1\r\niOS Version: 8.1 iPad 5G,\r\nti.cloud: 3.2.7\r\nOS X Version: 10.9.5,\r\nAppcelerator Studio: 3.4.1\r\n\r\nh3.Actual Result\r\ncallback is not working when the app is being opened directly.\r\n\r\nh3.Expected Result\r\n callback will work when the app is being opened directly.\r\n\r\nh3.Test Case\r\n{code:title=app.js}\r\nvar Cloud = require(\"ti.cloud\");\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n\tlayout : 'vertical',\r\n\texitOnClose : true\r\n});\r\n\r\nvar subscribeBtn = Ti.UI.createButton({\r\n\ttitle : 'Subscribe',\r\n\ttop : 50,\r\n});\r\nsubscribeBtn.addEventListener('click', function() {\r\n\tloginUser();\r\n});\r\n\r\nfunction loginUser() {\r\n\t// Log in to ACS\r\n\tCloud.Users.login({\r\n\t\tlogin : 'userName',\r\n\t\tpassword : 'PASS'\r\n\t}, function(e) {\r\n\t\tif (e.success) {\r\n\t\t\talert('Login successful');\r\n\t\t\tsubscribeToChannel();\r\n\t\t} else {\r\n\t\t\talert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Retrive Device token\r\n\r\nvar deviceToken = null;\r\n\r\n// Check if the device is running iOS 8 or later\r\nif (Ti.Platform.name == \"iPhone OS\" && parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) {\r\n\tfunction registerForPush() {\r\n\t\tTi.Network.registerForPushNotifications({\r\n\t\t\tsuccess : deviceTokenSuccess,\r\n\t\t\terror : deviceTokenError,\r\n\t\t\tcallback : receivePush\r\n\t\t});\r\n\t\t// Remove event listener once registered for push notifications\r\n\t\tTi.App.iOS.removeEventListener('usernotificationsettings', registerForPush);\r\n\t};\r\n\r\n\t// Wait for user settings to be registered before registering for push notifications\r\n\tTi.App.iOS.addEventListener('usernotificationsettings', registerForPush);\r\n\r\n\t// Register notification types to use\r\n\tTi.App.iOS.registerUserNotificationSettings({\r\n\t\ttypes : [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE]\r\n\t});\r\n\r\n} else {\r\n\t// For iOS 7 and earlier\r\n\tTi.Network.registerForPushNotifications({\r\n\t\t// Specifies which notifications to receive\r\n\t\ttypes : [Ti.Network.NOTIFICATION_TYPE_BADGE, Ti.Network.NOTIFICATION_TYPE_ALERT, Ti.Network.NOTIFICATION_TYPE_SOUND],\r\n\t\tsuccess : deviceTokenSuccess,\r\n\t\terror : deviceTokenError,\r\n\t\tcallback : receivePush\r\n\t});\r\n}\r\n\r\n// Process incoming push notifications\r\nfunction receivePush(e) {\r\n\talert('Received push: ' + JSON.stringify(e));\r\n}\r\n\r\n// Save the device token for subsequent API calls\r\nfunction deviceTokenSuccess(e) {\r\n\tdeviceToken = e.deviceToken;\r\n}\r\n\r\nfunction deviceTokenError(e) {\r\n\talert('Failed to register for push notifications! ' + e.error);\r\n}\r\n\r\nfunction subscribeToChannel() {\r\n\tCloud.PushNotifications.subscribeToken({\r\n\t\tdevice_token : deviceToken,\r\n\t\tchannel : 'news_alerts',\r\n\t\ttype : Ti.Platform.name == 'android' ? 'android' : 'ios'\r\n\t}, function(e) {\r\n\t\tif (e.success) {\r\n\t\t\talert('Subscribed');\r\n\t\t} else {\r\n\t\t\talert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));\r\n\t\t}\r\n\t});\r\n}\r\n\r\nwin.add(subscribeBtn);\r\nwin.open();\r\n\r\n{code}\r\n\r\nThanks.", "attachment": [], "flagged": false, "summary": "iOS:Push notification callback is not working when app is being opened directly from app drawer.", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": null, "comment": { "comments": [ { "id": "337617", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Was able to reproduce this issue in both SDK 3.4.1.GA and 3.5.0.\r\n\r\nTested on:\r\n\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nSDK build: 3.4.1.GA, 3.5.0.v20141222103320\r\nCLI: 3.4.1\r\nAlloy: 1.5.1\r\nXcode: 6.2 beta 3\r\nDevices: iphone 6 plus (8.1.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-12-29T23:31:22.000+0000", "updated": "2014-12-29T23:31:22.000+0000" }, { "id": "441402", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "It still an issue with the latest Ti SDK 7.3.1.GA \r\n\r\nTested on:\r\nAppcelerator Command-Line Interface, version 7.0.6\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\nNode.js\r\n Node.js Version = 8.10.0\r\n npm Version = 5.8.0\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.3.1.GA\r\nDevice = iphone 5s (11.4.1)\r\nti.cloud version = 3.2.111\r\nXcode: 9.4.1", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-09-07T06:17:07.000+0000", "updated": "2018-09-07T06:17:07.000+0000" }, { "id": "442430", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Another issue with the latest Ti SDK version, if I press the home button for closing or backgrounding the App then send a push notification, the callback function is not firing. \r\n\r\n*Testing Environment:*\r\nTi SDK v7.4.0.GA\r\nXcode v10\r\nDevice? iPhone 5s v iOS12\r\n\r\n*Steps To Reproduce:*\r\n\r\n1. Create a new push App and configure it.\r\n2. Send push notification and open the App from the push notification center, in this case, the callback function is firing.\r\n3. Now press the HOME button and send the push notification again and open the App from the push notification center, in this case, the callback function is not working. This is the issue.\r\n \r\nLet us know if it's an issue or default behavior.\r\n\r\nSample code: https://github.com/oneilmarcelo/pushnotification-appcelerator-ios/tree/master/net.chleba.pushnotificationios/app\r\n\r\nThanks!\r\n", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-10-09T06:12:39.000+0000", "updated": "2018-10-09T06:17:12.000+0000" }, { "id": "442432", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~morahman] In 7.4.1 there are many notification related issues has been fixed TIMOB-26399 and TIMOB-26444. Can you once check the behaviour using 7.4.1 SDK. \r\nYou can get SDK via CLI -\r\n appc ti sdk install -b 7_4_X\r\n\r\nThanks!", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-09T06:40:04.000+0000", "updated": "2018-10-09T06:40:04.000+0000" }, { "id": "442646", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~vijaysingh], My commented issue has been fixed with the latest Ti SDK 7.4.1 but still is an issue with the described issue.\r\n\r\nThanks!", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-10-16T09:26:43.000+0000", "updated": "2018-10-16T09:26:43.000+0000" }, { "id": "442678", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~morahman] What do you mean by \"but still is an issue with the described issue\"? Which issue is still there?", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-17T06:06:11.000+0000", "updated": "2018-10-17T06:06:11.000+0000" }, { "id": "442741", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~vijaysingh], Please look at the description box for that issue. \"Push notification callback is not working when app is being opened directly from app drawer\". Not sure it's an issue or normal behavior.\r\n\r\nThanks!", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-10-18T04:50:54.000+0000", "updated": "2018-10-18T04:51:50.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }