Android Geolocation Manual Mode

You must Login before you can answer or comment on any questions.

Has anyone successfully used the new Android Geolocation manual mode? I have been trying to get it to work but the function

Ti.Geolocation.Android.setManualMode(true);
comes back with a null reference exception saying the method is undefined. After looking through the source code it appears that
Ti.Geolocation.Android.manualMode = true;
also will not turn on manual mode. Any ideas on how to enable this?

1 Answer

I think you also need to define custom gps/wifi provider and gps/wifi location rule:

For example:

Ti.Geolocation.Android.manualMode = true;
 
    // modify only the gps
    var gpsProvider = Ti.Geolocation.Android.createLocationProvider({
        name: Ti.Geolocation.PROVIDER_GPS,
        minUpdateTime: 30, 
        minUpdateDistance: 100
    });
    Ti.Geolocation.Android.addLocationProvider(gpsProvider);
 
    var gpsRule = Ti.Geolocation.Android.createLocationRule({
        provider: Ti.Geolocation.PROVIDER_GPS,
        accuracy: 100, // in meters
        maxAge: (1000 * 30),
        minAge: (1000 * 5)
    });
    Ti.Geolocation.Android.addLocationRule(gpsRule);
Configuration depends on what you need so you might need to tweak that.

— answered 8 months ago by Rey Bumalay
answer permalink
3 Comments
  • I appreciate the answer but I understand how manual mode is supposed to work. What I am saying is that the line

    Ti.Geolocation.Android.manualMode = true;
    does nothing in the underlying Java code since the Android module doesn't handle the propertyChanged event for 'manualMode' and the documented setManualMode function throws a method not defined error. I'd like to know if there is some other way in which I can get this working.

    — commented 8 months ago by Jason Sznol

  • I apologize, I'll investigate your code further, it looks like setting manualMode to true in the way you describe might actually work.

    — commented 8 months ago by Jason Sznol

  • I can't get setManualMode to work either but modifying Ti.Geolocation.Android.manualMode looks to work on our end. We usually set this to manual mode on startup but we haven't tried changing it while app is running.

    This is base on live tests made on road/highway.

    — commented 8 months ago by Rey Bumalay

Your Answer

Think you can help? Login to answer this question!