location

error handling in android. exception Caused by: java.lang.IllegalArgumentException: provider=gps

ぃ、小莉子 提交于 2019-12-11 05:37:43
问题 I've received an error report for one of my apps. I'm pretty much a beginner in android development, and don't quite understand where this could originate from. Where is the app code would it be best to catch all errors and for example just toast message that an error occured? My app basically sits and waits for GPS and/or Network location before displaying a button. This is the error: java.lang.RuntimeException: Unable to resume activity {fr.mcnamara.irelandtravelguide/fr.mcnamara

Ask for only Request Always Authorization, and not When-In-Use Authorization

混江龙づ霸主 提交于 2019-12-11 05:14:09
问题 In iOS 11 onwards we follow these instructions from Apple: You are required to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUsageDescription keys in your app's Info.plist file. (If your app supports iOS 10 and earlier, the NSLocationAlwaysUsageDescription key is also required.) If those keys are not present, authorization requests fail immediately. This shows both "Always" and "When in Use" options when the user is prompted to enable location tracking. However

Location updates not working on allowing runtime permission

梦想的初衷 提交于 2019-12-11 05:07:38
问题 I've written code for app that shows phone's latitude and longitude and displays it on the screen, but after granting location permission it doesn't show anything, only when I reopen the app. This is the code for the MainActivity: import android.Manifest; import android.content.pm.PackageManager; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import

Android location always null

心不动则不痛 提交于 2019-12-11 04:53:45
问题 I had my application to find location working, but I changed some code and now the location always returns null. Ashamedly I am not sure what code I had changed, but I just cant seem to get it working. Can anyone see why this returns null? I have been working on this all day with no joy. code below: ....imports.... public class Clue extends Activity { public static double latitude; public static double longitude; Criteria criteria; LocationManager lm; LocationListener ll; Location location;

GeoDjango: How can I get the distance between two points?

有些话、适合烂在心里 提交于 2019-12-11 04:27:27
问题 My Profile model has this field: location = models.PointField(geography=True, dim=2, srid=4326) I'd like to calculate the distance between the two of these locations (taking into account that the Earth is a spheroid) using GeoDjango, so that I can store this distance in the database. How can I calculate this distance with GeoDjango? What units are the results in? Is there a 'best' way to store this data? Float? Decimal? I've reviewed previous, similar questions, and haven't found them useful.

Android Google API direction update

丶灬走出姿态 提交于 2019-12-11 04:13:35
问题 I am using Google API in my app. Everything works perfectly. I just want to know how to update directions while moving. For now I have button "Actualize direction", but I want to do it dynamically. For example I want to update it (maybe offline if it is possible?) after changing my actual location. I think that this app will be used by drivers so it would be good to have dynamical updating of those directions. Is it possible to do something like this? Thx for help 回答1: Implementing such kind

onLocationChanged never gets called Emulator

风流意气都作罢 提交于 2019-12-11 04:06:42
问题 package com.ecsmon.android.core; import static com.ecsmon.android.constants.Constants.log; import java.io.IOException; import java.util.List; import android.annotation.SuppressLint; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; @SuppressLint("NewApi") public class

getLastKnownLocation vs requestLocationUpdates

吃可爱长大的小学妹 提交于 2019-12-11 03:45:50
问题 I want to send the most fresh and accurate location from my android app to the server every 5 min. In this question I was advised to create an alarmManager which will register to LocationUpdates. Why is this better than just calling getLastKnownLocation and checking its accuracy? 回答1: getLastKnownLocation will give you the last location fix from the network provider. It may not give the exact current location (see google documentation) LocationUpdates, on the other hand, will give the current

Android new location API Altitude is always zero

喜欢而已 提交于 2019-12-11 03:45:11
问题 I am using Google new location Api in my app like this private static final LocationRequest REQUEST = LocationRequest.create().setInterval(2000).setFastestInterval(1000) .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); private LocationListener mLocationListener = new LocationListener() { @Override public void onLocationChanged(final Location location) { if(location.hasAltitude()){ Log.e(TAG, "Altitude " + location.getAltitude()); }else{ Log.e(TAG, "Location does not have altitude"); } }

How widely supported are scheme-relative URIs in HTTP 301 redirects

半城伤御伤魂 提交于 2019-12-11 03:39:42
问题 I want to have requests for the www subdomain or for alternate top-level domains redirected to one canonical URL. To avoid HTTP/HTTPS issues, I figured the easiest way would be to just send a scheme-relative URI in the Location header, like so: HTTP/1.1 301 Moved Permanently Location: //example.com/ This seems to work fine in browsers, but the toy »validator« at http://no-www.org/ does not handle it correctly. Is this just a single badly written script, or is this behavior actually more