{ "id": "171536", "key": "TIMOB-25974", "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": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-06-06T01:31:05.000+0000", "created": "2018-04-18T12:14:29.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "location", "service" ], "versions": [], "issuelinks": [ { "id": "56473", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "124125", "key": "TIMOB-16066", "fields": { "summary": "Android: Add \"foreground\" service support", "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": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-06-19T21:57:15.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": "*Issue Overview:*\r\nI need my app to get the location every 5 seconds. \r\nIt seems when the phone becomes 'locked' and the screen goes off, the location updates very rarely. If I request the location the timestamp of the location object doesn't change.\r\nI've tried manual mode but I get the same result.\r\n\r\nHow can I get the realtime location when the phone is on or off?\r\n\r\n*Reproduction:*\r\nRun the test code\r\nCheck the log and observe that the timestamp never changes. So it seems the geolocation doens't expire after 10 seconds.\r\n\r\n*index.js*\r\n{code}\r\nfunction getLocation() {\r\n Ti.Geolocation.addEventListener('location', function(e) {\r\n alert(JSON.stringify(e, null, 2));\r\n });\r\n}\r\n\r\n$.win.addEventListener('open', function() {\r\n if (Ti.Geolocation.hasLocationPermissions()){\r\n getLocation();\r\n } else {\r\n Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n if (e.success) {\r\n getLocation();\r\n } else {\r\n alert('could not obtain location permissions');\r\n }\r\n });\r\n }\r\n});\r\n\r\nTi.Geolocation.Android.manualMode = true;\r\nvar gpsProvider = Ti.Geolocation.Android.createLocationProvider({\r\nname: Ti.Geolocation.PROVIDER_GPS,\r\nminUpdateTime: 5,\r\nminUpdateDistance: 1\r\n});\r\n\r\nvar gpsRule = Ti.Geolocation.Android.createLocationRule({\r\naccuracy: 100,\r\nmaxAge: 10000,\r\n});\r\n\r\nTi.Geolocation.Android.addLocationRule(gpsRule);\r\nsetInterval(function(){\r\nTitanium.Geolocation.getCurrentPosition(function(e){\r\nvar accuracy = e.coords.accuracy;\r\nvar timestamp = e.coords.timestamp;\r\nvar report = 'geo time: ' + new Date(timestamp) + ', accuracy: ' + accuracy;\r\n//$.label.text = report;\r\nconsole.log(report);\t\r\n});\r\n},5000);\r\n{code}\r\n\r\n*Output*\r\n{code}\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n[INFO] : geo time: Wed Apr 18 2018 11:06:28 GMT+0100 (BST), accuracy: 18.344999313354492\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Geolocation updates rarely on Android 8.0 while app is backgrounded", "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": "Appcelerator Command-Line Interface, version 7.0.2\r\nCopyright (c) 2014-2018, Appcelerator, Inc. All Rights Reserved.\r\n\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.1\r\n Architecture = 64bit\r\n CPUs = 4\r\n Memory = 8.0GB\r\n\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\n\r\nAppcelerator CLI\r\n Installer = 4.2.11\r\n Core Package = 7.0.2\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\n node-appc Version = 0.2.41\r\n\r\nTitanium SDKs\r\n 7.1.0.GA\r\n Version = 7.1.0\r\n\r\nPhysical Device: Samsung Galaxy J7(android 7)", "comment": { "comments": [ { "id": "437961", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10076\r\n\r\nSolution is to use an Android \"foreground\" service.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-05-26T03:56:27.000+0000", "updated": "2018-05-26T03:56:27.000+0000" }, { "id": "438536", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix in SDK 7.3.0.v20180618182516.\r\nClosing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-19T21:57:07.000+0000", "updated": "2018-06-19T21:57:07.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }