{ "id": "154277", "key": "TIMOB-20229", "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": [ { "id": "17684", "name": "Release 5.2.1", "archived": false, "released": true, "releaseDate": "2016-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-02-29T03:06:20.000+0000", "created": "2016-01-13T09:10:42.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Android", "cookies", "webView" ], "versions": [], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-03-03T00:08:01.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": "We tried to setup cookie on a web view using this method \"createCookie\", \"addHTTPCookie\" and \"addSystemCookie\". But it does not work it only reads the default cookies but not set the cookie. Please take a look my sample code.\r\n\r\n*Steps to reproduce*\r\n1. Just run this sample code then check the consol log.\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tlayout : 'vertical'\r\n});\r\nvar url = 'http://www.appcelerator.com/'; //Or any html file\r\nvar reload = Ti.UI.createButton({\r\n\ttitle : 'reload',\r\n\theight : 50,\r\n\twidth : 100,\r\n\ttop : 5,\r\n});\r\n\r\nreload.addEventListener('click', function() {\r\n\tweb.url = url;\r\n});\r\n\r\nwin.add(reload);\r\n\r\nvar web = Ti.UI.createWebView({\r\n\turl : url,\r\n\twidth : Ti.UI.FILL,\r\n\ttop : 100,\r\n\theight : Ti.UI.FILL,\r\n\r\n});\r\n\r\nwin.add(web);\r\nvar i = 1;\r\n\r\nweb.addEventListener('load', function(e) {\r\n\r\n\tvar d = new Date();\r\n\td.setTime(d.getTime() + (2 * 24 * 60 * 60 * 1000));\r\n\t\r\n\t// You can try this(\"addHTTPCookie\", \"addSystemCookie\") insted of \"createCookie\"\r\n\r\n\tvar cookie = Ti.Network.createCookie({\r\n\t\tname : 'helloWorld',\r\n\t\tdomain : url,\r\n\t\tvalue : \"testCoockie\",\r\n\t\texpiryDate : d,\r\n\r\n\t});\r\n\r\n\tTi.API.info(\"createCookie -> \" + JSON.stringify(cookie));\r\n\r\n\tvar cookies = web.evalJS(\"document.cookie\").split(\";\");\r\n\tTi.API.info(\"# of cookies -> \" + cookies.length);\r\n\tfor ( i = 0; i <= cookies.length - 1; i++) {\r\n\t\tTi.API.info(\"cookie -> \" + cookies[i]);\r\n\t}\r\n\r\n});\r\n\r\nwin.open();\r\n\r\n\r\n{code}\r\n\r\nThanks.\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: Titanium.Network.\"Cookie\" API is not Working.", "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, "closedSprints": [ { "id": 574, "state": "closed", "name": "2016 Sprint 4 SDK", "startDate": "2016-02-13T01:33:48.415Z", "endDate": "2016-02-27T01:33:00.000Z", "completeDate": "2016-02-29T03:44:48.886Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "376601", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7706", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-11T08:27:50.000+0000", "updated": "2016-02-11T08:27:50.000+0000" }, { "id": "378095", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR merged into master", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-29T01:59:53.000+0000", "updated": "2016-02-29T02:02:27.000+0000" }, { "id": "378096", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Backport 5_2_X: https://github.com/appcelerator/titanium_mobile/pull/7784\r\n[~hpham] for review.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-29T02:16:29.000+0000", "updated": "2016-02-29T02:16:29.000+0000" }, { "id": "378515", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\n\r\n\"createCookie\", \"addHTTPCookie\" and \"addSystemCookie\" works as expected.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.5.0.201602170831\r\nTi SDK : 5.2.1.v20160228190750\r\nTi CLI : 5.0.6\r\nAlloy : 1.7.33\r\nMAC El Capitan : 10.11.13\r\nAppc NPM : 4.2.3\r\nAppc CLI : 5.2.0\r\nNode: 4.2.2\r\nNexus 6P - Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-03T00:07:55.000+0000", "updated": "2016-03-03T00:07:55.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }