Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19744] Android : Geolocation callback is not being called on android 6.0

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2015-10-29T00:46:32.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsqe-5.1.0
ReporterLokesh Choudhary
AssigneeChee Kiat Ng
Created2015-10-19T21:40:10.000+0000
Updated2017-03-20T13:59:02.000+0000

Description

Steps To Reproduce: 1. Use the code below in the app.js.
var win1 = Titanium.UI.createWindow({
    title : 'Tab 1',
    backgroundColor : '#fff'
});

var latitude = 33.58262112511852;
var longitude = -111.71566843986511;

var locationCallback = function(e) {
    if(!e.success || e.error) {  
        alert('error:' + JSON.stringify(e.error));  
        return;  
    }
    Ti.API.info(JSON.stringify(e));

    var longitude = e.coords.longitude;
    var latitude = e.coords.latitude;

};
win1.addEventListener("open", function(e) {

    if (Ti.Geolocation.hasLocationPermissions()) {
        Ti.Geolocation.preferredProvider = "gps";
        Titanium.Geolocation.addEventListener('location', locationCallback);
    } else {
        Ti.Geolocation.requestLocationPermissions(function(e) {
                    if (e.success === true) {
                        Ti.Geolocation.preferredProvider = "gps";
                        Titanium.Geolocation.addEventListener('location', locationCallback);
                    } else {
                        alert("Access denied, error: " + e.error);
                    }
        });
    }
});

win1.open();
2. Build the app on android device running android 6.0. 3. After the app launches the app would ask permission to access location. 4. Grant access by tapping ok 5. Let the app launch & check the logs in studio console.

Actual Results:

1. The location callback is not called & no info is seen relating to location in the console. 2. Works fine with android 5.1.1, android 4.4.4. *Android 5.1.1 logs:*
[INFO] :   {"type":"location","source":{"bubbleParent":true,"hasCompass":true,"__propertiesDefined__":true,"_events":{"location":{}},"preferredProvider":"gps","lastGeolocation":"{\"latitude\":37.3676949,\"longitude\":-121.9137751,\"altitude\":0,\"accuracy\":67.5,\"heading\":0,\"speed\":0,\"timestamp\":1445290117314}","locationServicesEnabled":true,"apiName":"Ti.Geolocation"},"provider":{"power":1,"name":"network","accuracy":2},"coords":{"altitude":0,"speed":0,"longitude":-121.9137751,"heading":0,"latitude":37.3676949,"timestamp":1445290117314,"altitudeAccuracy":null,"accuracy":67.5},"bubbles":false,"success":true,"code":0,"cancelBubble":false}

Expected Results:

1. The location callback should be called & location info should get printed in the console

Comments

  1. Chee Kiat Ng 2015-10-20

    [~hpham] can you take a look please?
  2. Lokesh Choudhary 2015-10-29

  3. Adam Paxton 2015-11-10

    The callback doesn't appear to be called for iOS, either. And on Android, couldn't TIMOB-19821 be worked around but just viewing LogCat? Not seeing it there, either. {noformat} Operating System Name = Mac OS X Version = 10.10.5 Architecture = 64bit # CPUs = 4 Memory = 8589934592 Node.js Node.js Version = 0.10.40 npm Version = 2.14.3 Titanium CLI CLI Version = 5.0.5 Titanium SDK SDK Version = 5.1.0.v20151104190037 SDK Path = /Users/adam/Library/Application Support/Titanium/mobilesdk/osx/5.1.0.v20151104190037 Target Platform = android {noformat}
  4. Debuisson Eugène 2017-03-20

    Any news about that ? It's seems that it still not working ...

JSON Source