0
votes

on Android device there are at least two options for geolocation:

  1. GPS Satellites
  2. WiFi & Mobile network location

if #1is checked then LocationManager.getCurrentLocationSync gets a proper location but what if only #2 is checked? On my device I simply get LocationManager.OUT_OF_SERVICE and thats it...

If I use LocationManager.getCurrentLocation when #1==false && #2==true I get null...

How can I read devices location based on WiFi & Mobile network location if GPS is turned off? ( or we are not outdoors for example )

1

1 Answers

0
votes

As discussed here (3rd paragraph): http://www.codenameone.com/blog/easy-demos-flip-more.html

You can just define the build hint: android.includeGPlayServices=true

Which will implicitly switch the location API to use the Google Play Services hybrid location. This will use the GPS when available, but also many other sensor elements to produce a more accurate and battery efficient location.