[AC-1753] App crashes on Android when firing synthetic geo-location event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2014-01-31T17:25:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy |
Labels | alloy, android-4.2.2, geolocation |
Reporter | Michael Stelly |
Assignee | Ritu Agrawal |
Created | 2014-01-26T20:26:39.000+0000 |
Updated | 2016-03-08T07:40:38.000+0000 |
Description
First, this app works as intended on iOS simulator and iPhone 5.
I launch the app, navigate to my TableView, and select a row which fires the breakpoint at the custom event. Stepping through the code on my android device,
I call my geoLocation event
Ti.API.fireEvent('getCurrentPosition');
which fires
Ti.App.addEventListener('getCurrentPosition', function() {
Ti.Geolocation.getCurrentPosition(updateGeolocation);
});
which in turn calls
function updateGeolocation(e) {
Ti.App.Properties.setDouble('geo.lat', e.coords.latitude);
Ti.App.Properties.setDouble('geo.lon', e.coords.longitude);
return;
}
. Upon reaching updateGeoLocation(), the app crashes with an error(see screenshot) with the console output noted in the attached text file. Something is definitely wrong with the geo-location piece because if I comment it out, I can navigate to the row's child record. I tried getting assistance on the forum, but never got any response whatsoever. Finally, when the app launches, it performs a geo-permission test like this:
function checkGeoPermission() {
if (Ti.Geolocation.locationServicesEnabled === false) {
helper.showDialog({
title : 'Mapping Error',
message : 'Your device has geo turned off - turn it on.'
});
} else {
if (OS_IOS) {
var authorization = Ti.Geolocation.getLocationServicesAuthorization();
if (authorization == Ti.Geolocation.AUTHORIZATION_DENIED) {
helper.showDialog({
title : 'Mapping Error',
message : 'You have disallowed App from running geolocation services.'
});
} else if (authorization == Ti.Geolocation.AUTHORIZATION_RESTRICTED) {
helper.showDialog({
title : 'Mapping Error',
message : 'Your system has disallowed App from running geolocation services.'
});
}
}
}
return;
};
I think this may be a bug with how android handles location services. If I can get help resolving it, I would be most grateful.
Regards,
Mike.
Attachments
File | Date | Size |
---|---|---|
foodtruck-console.txt | 2014-01-26T20:26:39.000+0000 | 25137 |
Screenshot_2014-01-26-13-33-43.png | 2014-01-26T20:26:39.000+0000 | 68349 |
I noticed that you are checking Geo permission for iOS platform but not for Android platform. Can you check for permissions on Android platform in checkGeoPermission function as well? It may also be related to not having the correct geo entry in the manifest file. Please provide a simple but complete test case to reproduce this issue.
Ritu, I wasn't able to find any specific Android related location services permission checks in the api. The Ti.Geolocation.Android doc states, {quote}Manual configuration is recommended for applications that have more demanding geolocation needs (for example, driving directions). However, for basic geolocation information, *simple mode* geolocation may be sufficient.{quote} I am using simple mode, so the only check I do for android is in my init() method,
If you know of something else in the api that I haven't found, please let me know. As for a test case, I gave you what I have. The app's table view links to an ACS table for which you don't have access, so that won't help you at all. How else can I help move this forward?
Thanks for the update. We need a complete runnable test case that we can run as it is to reproduce exactly the same issue you are running into. You don't need to provide us access to ACS table as you should be able to reproduce this issue without ACS by putting some dummy values in the table view.
Ritu, Please close. It must not be a bug, because I cannot replicate the error with a test case. Sorry to waste your time. Regards.
No problem [~madcode].