[AC-1837] iOS: geolocation is active when there are no listeners attached
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-06-13T16:47:16.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | bug, geolocation, ios |
Reporter | Ilya Shapovalov |
Assignee | Mauro Parra-Miranda |
Created | 2013-05-24T18:11:05.000+0000 |
Updated | 2016-03-08T07:40:44.000+0000 |
Description
*Problem description*
Geolocation icon ("arrow") is visible in iPhone status bar, but there are no listeners attached to Ti.Geolocation. Location services seems to be active and consuming battery. The icon disappears only after uninstalling the app. Killing it is useless.
Also, in console log there is a line:
May 24 21:56:22 Ilya-Shapovalovs-iPhone locationd[46] <Notice>: Location icon should now be in state 'Active'
And there should be line with "Location icon should now be in state 'Inactive'", but there isn't.
This problem was encountered by end users of the app at first (so, it covers different versions of iOS and different iPhone models).
*Steps to reproduce*
1. create new project - titanium - single window application
2. Insert following code in app.js or ApplicationWindow.js:
var win = Ti.UI.createWindow({
backgroundColor : "#FFF"
});
//Ti.Geolocation.trackSignificantLocationChange = true; - tried this one also. In log there is a couple of "cb", a couple of "timeout" but the rest of the log is same (it's provided below)
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_LOW;
var cb = function() {
console.log('cb');
if (false) { // immediate removal of listener does not solve my issue, either
Ti.Geolocation.removeEventListener('location', cb);
} else {
setTimeout(function() {
console.log('timeout');
Ti.Geolocation.removeEventListener('location', cb);
}, 3000);
}
}
Ti.Geolocation.addEventListener('location', cb);
win.open();
*Log*
May 24 22:03:26 Ilya-Shapovalovs-iPhone testgeo[1541] <Warning>: [DEBUG] Application booted in 1071.326017 ms
May 24 22:03:27 Ilya-Shapovalovs-iPhone testgeo[1541] <Warning>: [INFO] cb
May 24 22:03:28 Ilya-Shapovalovs-iPhone locationd[46] <Notice>: Location icon should now be in state 'Active'
May 24 22:03:28 Ilya-Shapovalovs-iPhone awdd[1548] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
May 24 22:03:28 Ilya-Shapovalovs-iPhone awdd[1548] <Error>: CoreLocation: CLClient is deprecated. Will be obsolete soon.
May 24 22:03:30 Ilya-Shapovalovs-iPhone locationd[46] <Notice>: received EBUSY, try kScanTypeChannel, channel, 6, rssi -60, delayed 0.000s
May 24 22:03:30 Ilya-Shapovalovs-iPhone testgeo[1541] <Warning>: [INFO] timeout
The problem exsists in master, too (commit 16c168ec582446015bc7d0f0dd6c8ddbcb05c7bb) As a temporary workaround, I added the following code to GeolocationModule.m:
And now if i manually call Ti.Geolocation.forceStop(), geolocation icon disappears from status bar within 5..10 seconds. I also unsuccessfully tried to call (not documented) method Ti.Geolocation.restart(), and (unsuccessfully either) tried code like this:
I hope I will get a response. I definitely will, of course, in due course. At the appropriate juncture. When the moment is ripe. In the fullness of time. I will, guys, right? Guys? Anyone?
Cannot reproduce on iOS 6 simulator, iPad 3 or iPhone 4 with 3.1 GA or 3.2 CI. The Geolocation indicator turns off after roughly 10 seconds with both immediate removal and timeout removal. As concluded in TIMOB-11831, please make sure that you turn off everything related to Geolocation, including trackSignificantLocationChange.
Closed by TIMOB-11831