/** * Asynchronously fetches the current location of the device. * <p> * This will use a default {@link Criteria} with no accuracy or power requirements, which will * generally result in slower, but more accurate location fixes. * <p/> * <strong>Note:</strong> If GPS is the best provider, it might not be able to locate the device * at all and timeout. * * @param timeout The number of milliseconds to allow before timing out. * @param callback callback.done(geoPoint, error) is called when a location is found. * @see android.location.LocationManager#getBestProvider(android.location.Criteria, boolean) * @see android.location.LocationManager#requestLocationUpdates(String, long, float, android.location.LocationListener) */ public static void getCurrentLocationInBackground(long timeout, LocationCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(getCurrentLocationInBackground(timeout), callback); }
/** * Asynchronously fetches the current location of the device. * <p> * This will request location updates from the best provider that match the given criteria * and return the first location received. * <p> * You can customize the criteria to meet your specific needs. * * For higher accuracy, you can set {@link Criteria#setAccuracy(int)}, however result in longer * times for a fix. * * For better battery efficiency and faster location fixes, you can set * {@link Criteria#setPowerRequirement(int)}, however, this will result in lower accuracy. * * @param timeout The number of milliseconds to allow before timing out. * @param criteria The application criteria for selecting a location provider. * @param callback callback.done(geoPoint, error) is called when a location is found. * @see android.location.LocationManager#getBestProvider(android.location.Criteria, boolean) * @see android.location.LocationManager#requestLocationUpdates(String, long, float, android.location.LocationListener) */ public static void getCurrentLocationInBackground(long timeout, Criteria criteria, LocationCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(getCurrentLocationInBackground(timeout, criteria), callback); }