Hi all, i need to know if the GPS is enabled on Android. This is useless because return always true.
In native Java we have:
final LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE ); if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER )and in Titanium there is a method for it but is protected in TiLocationHelper.java:
protected static boolean isValidProvider(String name) { boolean enabled = (name.equals(LocationManager.GPS_PROVIDER) || name.equals(LocationManager.NETWORK_PROVIDER)); if (enabled) { enabled = false; try{ enabled = isLocationProviderEnabled(name); } catch(Exception ex){ ex = null; } finally { if (!enabled) { Log.w(LCAT, "Preferred provider [" + name + "] isn't enabled on this device. Will default to auto-select of GPS provider."); } } } return enabled; }Someone can help me?