[TIMOB-20102] Android 6.0 - 5.1.1.GA - Location permissions missing
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-02-17T14:41:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android |
Labels | n/a |
Reporter | Flavio Lacerda |
Assignee | Eric Merriman |
Created | 2015-12-03T21:32:31.000+0000 |
Updated | 2017-02-17T14:41:58.000+0000 |
Description
When you try to use Geolocation to discover position (getCurrentPosition), returns error on Android Log: (KrollRuntimeThread) Location permissions missing. The callback is not fired.
SDK : 5.1.1.GA
Android 6.0
SDK 5.0.2.GA works fine
Hello, We tested this issue and observed that getCurrentPosition() is not working as expected on Android 6. On Android 4.4.2 it's working as expected. *Testing Environment:* Titanium SDK version 5.1.1.GA Appcelerator Studio, build: 4.4.0.201511241829 Mac OS X Version = 10.11.1 Architecture = 64bit Node.js Version = 0.12.7 npm Version = 2.11.3 Appcelerator CLI Installer = 4.2.2 Core Package = 5.1.0 Titanium CLI Version = 5.0.5 node-appc Version = 0.2.31 Android device: Nexus 7(android 6) Samsung Tab: Android (4.4.2) *Test Case:*
*Steps to test:* 1. Create a classic project, replace app.js with the above code Build and run the project on android version 4.4.2 and observe that the device location is seen. Now run the project on android 6 and observe that device location is not visible. Thanks.
I'm seeing the same error. As far as I can tell, this is still an issue.
Downgrading to 5.0.2.GA and downgrading node.js to 0.12 worked for me.
Is it possible to get this ticket re-opened and re-looked at. It was closed out without comment as simply "can't reproduce" but it does seem to be affecting multiple users.
Has a workaround other than downgrading to 5.0.2 been found for this? I'm having the issue on 5.1.2.GA as well... Android 6.0 cannot find location. and repeatedly spits out this error: {color:red}[ERROR] : GeolocationModule: (KrollRuntimeThread) [2002,271792] Location permissions missing{color}
I'm also getting this error on SDK 5.1.2 GA. [ERROR] : GeolocationModule: (KrollRuntimeThread) [9525,9525] Location permissions missing My AndroidManifest has the following location permissions:
Getting the same error on Nexus 5 with Android 6 and 5.1.2.GA. Reverting to 5.0.2 it works again. Please reopen this ticket! I'm guessing this has something to do with this: http://developer.android.com/training/permissions/requesting.html Since I'm targeting API 23 and running Android 6.0 but I'm not getting a request for location permissions at runtime.
For those of you still waiting for a fix but who don't want to downgrade the Titanium SDK, here's a solution: Since Android 6.0 it's not sufficient to just declare your permissions in the manifest, you have to ask for it at runtime. Translating this to Titanium: {noformat} if(!Titanium.Geolocation.hasLocationPermissions(Titanium.Geolocation.AUTHORIZATION_ALWAYS)) { Titanium.Geolocation.requestLocationPermissions(Titanium.Geolocation.AUTHORIZATION_ALWAYS, function(result){ if(!result.success) { //no location permissions flow triggers } else { //do something } }); } {noformat}
Replicated this problem(callback not called on getcurrentposition) Ti SDK 5.2.2 Android 6.0
I am also getting same error!!! Callback function getcurrentposition() is not getting called even if Titanium.Geolocation.AUTHORIZATION_ALWAYS permission is granted
[~chandan] Did you request the permission at runtime?
Yes added runtime permission to access camera like as below: [if(!Titanium.Geolocation.hasLocationPermissions(Titanium.Geolocation.AUTHORIZATION_ALWAYS)) { Titanium.Geolocation.requestLocationPermissions(Titanium.Geolocation.AUTHORIZATION_ALWAYS, function(result){ if(!result.success) { //no location permissions flow triggers } else { //do something } }); }]
To see which permissions that's really needed and what's not requested, inside Android you can go to: Settings>Apps>"YourAppName">Permissions> If you can see what permission is not used or in use. You can click it to see if it helps. To address this further, in 5.4.0 (future), you can use
Ti.Android.requestPermissions()
https://github.com/appcelerator/titanium_mobile/blob/ff3acd9a1f1ffcd82a634700e3457ce269e463fe/apidoc/Titanium/Android/Android.yml#L197-L212 Jira for ref: TIMOB-20320