{ "id": "169191", "key": "TIMOB-25035", "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": "10000", "description": "", "name": "Done" }, "resolutiondate": "2019-01-16T06:29:34.000+0000", "created": "2017-07-31T08:43:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" }, { "id": "19572", "description": "Important fixes for 6.1.0", "name": "Release 6.1.1", "archived": false, "released": true, "releaseDate": "2017-06-16" } ], "issuelinks": [], "assignee": null, "updated": "2019-07-17T05:49:58.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": "*Problem Description:*\r\nI'm using geolocation in my application. When I grant app location permission manually for my application it doesn't manage to show the location. I am using latest Ti SDK 6.1.1.GA, 6.0.1.GA. Using a Google Pixel running android 7 and a Sony C4 android 5.1 and it happens every time. It does not happen on the Samsung Galaxy though.\r\n\r\n*Steps to reproduce:*\r\n- Create a new Alloy project with the sample code below and launch the app, it will request for location permissions. If you grant the permission then the app will alert the coordinates.\r\n- But if you launch the app, then deny location permission \r\n- Then go to settings > apps and then grant the app location permissions\r\n- Now, when you launch the app again it does not manage to get the location. \r\n- If you then launch Google Maps or any other app that uses location and then go back into the app it suddenly works again.\r\n\r\nIt's almost as if the app requires a different app to use the location before it can use it again.\r\n\r\n\r\n*Test Code:*\r\nindex.js\r\n{code}\r\n$.index.open();\r\n\r\nif (!Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS)) {\r\nTi.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n\r\n});\r\n} else {\r\ngetGps();\r\n}\r\n\r\nfunction getGps() {\r\n\r\nvar coords = {};\r\nvar method = \"\";\r\n\r\nvar providerGps = Ti.Geolocation.Android.createLocationProvider({\r\nname : Ti.Geolocation.PROVIDER_GPS,\r\nminUpdateDistance : 0.0,\r\nminUpdateTime : 0\r\n});\r\n\r\nTi.Geolocation.Android.addLocationRule(Ti.Geolocation.Android.createLocationRule({\r\nprovider : Ti.Geolocation.PROVIDER_GPS,\r\naccuracy : Alloy.CFG.accuracy,\r\nmaxAge : Alloy.CFG.maxAge,\r\nminAge : Alloy.CFG.minAge\r\n}));\r\n\r\nTi.Geolocation.Android.addLocationProvider(providerGps);\r\nTi.Geolocation.Android.manualMode = true;\r\n\r\nTitanium.Geolocation.getCurrentPosition(function(e) {\r\nif (e.error) {\r\nif ( typeof errorCallback != \"undefined\" && errorCallback != null) {\r\nalert(e.error);\r\n}\r\n} else {\r\nmethod = e.provider.name;\r\ncoords = e.coords;\r\n\r\nalert(coords);\r\n\r\n}\r\n});\r\n\r\n}\r\n{code}\r\nindex.xml\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: App doesn't get the location when location permission is granted manually. ", "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": "Operating System\r\nName = Microsoft Windows 10 Enterprise\r\nVersion = 10.0.15063\r\nArchitecture = 64bit\r\n# CPUs = 4\r\nMemory = 15.9GB\r\n\r\nNode.js\r\nNode.js Version = 4.8.0\r\nnpm Version = 2.15.11\r\n\r\nAppcelerator CLI\r\nInstaller = 4.2.9\r\nCore Package = 6.2.2\r\n\r\nTitanium CLI\r\nCLI Version = 5.0.14\r\nnode-appc Version = 0.2.41\r\n\r\nTitanium SDKs\r\n6.1.1.GA, 6.0.1.GA\r\nPhysical Device: Google Pixel running android 7 and a Sony C4 android 5.1", "comment": { "comments": [ { "id": "430343", "author": { "name": "etoma", "key": "etoma", "displayName": "Enrico Toma", "active": true, "timeZone": "Europe/Rome" }, "body": "I have the same problem, but with automatic provider, in this configuration:\r\n- Ti SDK 6.3.0\r\n- Android 6\r\n- Galaxy S7\r\n\r\nFollowing this step:\r\n- start device and activate localization.\r\n- open my app and after permission request, the properties Ti.Geolocation.locationServicesEnabled return false, then the Ti.Geolocation.getCurrentPosition fail.\r\n- close my app, open google maps. \r\n- return in my app and Ti.Geolocation.locationServicesEnabled return true, getCurrentPosition now is ok!\r\n- After disable Localization in the device and then re-enable.\r\n- return to app and Ti.Geolocation.locationServicesEnabled it's still false.\r\n\r\nOn iOS the same code it's OK!\r\n\r\nI do not know how to do it. Hope you can help me\r\n\r\nThanks\r\n", "updateAuthor": { "name": "etoma", "key": "etoma", "displayName": "Enrico Toma", "active": true, "timeZone": "Europe/Rome" }, "created": "2017-11-09T08:19:13.000+0000", "updated": "2017-11-09T08:19:13.000+0000" }, { "id": "449857", "author": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "body": "I have the same issue, and it's been like this for ~3 years on one of my apps. I just had to accept that it wont work for some android users.\r\nThe only way to make the GPS \"kick in\" is to start google maps and then come back to my app.\r\n\r\nSo frustrating.", "updateAuthor": { "name": "rdperottoni", "key": "rdperottoni", "displayName": "Rodolfo Perottoni", "active": true, "timeZone": "Australia/Brisbane" }, "created": "2019-07-17T05:49:58.000+0000", "updated": "2019-07-17T05:49:58.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }