UIImagePickerController and extracting EXIF data from existing photos

Have you took a look at this exif iPhone library? http://code.google.com/p/iphone-exif/ Gonna try it on my side. I’d like to get the GPS (geotags) coordinates from the picture that has been taken with the UIImagePickerController :/ After a deeper look, this library seems to take NSData info as an input and the UIImagePickerController returns a … Read more

Best way to get user GPS location in background in Android [duplicate]

None of the rest of the answers use: com.google.android.gms.location.FusedLocationProviderClient Which is the Fused Location Provider and the main entry point for interacting with the fused location provider by Google, and it is very hard to find a good example. This was released mid 2017 by Google. Google Play services location APIs are preferred over the … Read more

How to get current location in Android [duplicate]

First you need to define a LocationListener to handle location changes. int LOCATION_REFRESH_TIME = 15000; // 15 seconds to update int LOCATION_REFRESH_DISTANCE = 500; // 500 meters to update …. private final LocationListener mLocationListener = new LocationListener() { @Override public void onLocationChanged(final Location location) { //your code here } }; Then get the LocationManager and … Read more

How can I check the current status of the GPS receiver?

As a developer of SpeedView: GPS speedometer for Android, I must have tried every possible solution to this problem, all with the same negative result. Let’s reiterate what doesn’t work: onStatusChanged() isn’t getting called on Eclair and Froyo. Simply counting all available satellites is, of course, useless. Checking if any of the satellites return true … Read more

How do I find out if the GPS of an Android device is enabled

Best way seems to be the following: final LocationManager manager = (LocationManager) getSystemService( Context.LOCATION_SERVICE ); if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) { buildAlertMessageNoGps(); } private void buildAlertMessageNoGps() { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(“Your GPS seems to be disabled, do you want to enable it?”) .setCancelable(false) .setPositiveButton(“Yes”, new DialogInterface.OnClickListener() { public void onClick(@SuppressWarnings(“unused”) final … Read more

Haversine Formula in Python (Bearing and Distance between two GPS points)

Here’s a Python version: from math import radians, cos, sin, asin, sqrt def haversine(lon1, lat1, lon2, lat2): “”” Calculate the great circle distance in kilometers between two points on the earth (specified in decimal degrees) “”” # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula … Read more

How can I enable or disable the GPS programmatically on Android?

the GPS can be toggled by exploiting a bug in the power manager widget. see this xda thread for discussion. here’s some example code i use private void turnGPSOn(){ String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(!provider.contains(“gps”)){ //if gps is disabled final Intent poke = new Intent(); poke.setClassName(“com.android.settings”, “com.android.settings.widget.SettingsAppWidgetProvider”); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse(“3”)); sendBroadcast(poke); } } private void turnGPSOff(){ … Read more

How do I get the current GPS location programmatically in Android?

I have created a small application with step by step description to get current location’s GPS coordinates. Complete example source code is in Get Current Location coordinates , City name – in Android. See how it works: All we need to do is add this permission in the manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> And create … Read more