gps

Android Location Manager Issue

匆匆过客 提交于 2019-12-20 04:53:20
问题 From the following code, I get the current location. Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); String provider = locationManager.getBestProvider(criteria, true); GlobalLocation = locationManager.getLastKnownLocation(provider); locationManager.requestLocationUpdates(provider, 2000, 10, locationListener)

Android: when stop gps listener force close?

女生的网名这么多〃 提交于 2019-12-20 04:11:58
问题 I got a force close when I tried to stop my gsp listener Here's the code: mlocManager.removeUpdates(mlocListener); mlocManager = null; and this: LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, (long) update, 0, mlocListener); Please help me, I don't understand why it force closes. 07-30 11:43:39.557: D/AndroidRuntime(1071):

Is it possible to get cities polygonal boundaries like in Google Maps?

我的梦境 提交于 2019-12-20 03:18:13
问题 I would like to have the possibility to tell if a GPS location is in an inhabited or uninhabited zone. I have tried some reverse geocoding services out there, but all of them proved useless, because they select the nearest address possible. (I understand why this should be so, it is useful for the purpose of reverse geocoding) I have noticed in Google Maps , when I search for a city, their boundaries are selected in red dotted well defined line. I would love it to use this, or something

Broadcast receiver for GPS state?

元气小坏坏 提交于 2019-12-20 03:17:27
问题 Is there a way to be notified when the GPS is switched on/off? I noticed that when the device is switched off an then on again, getLastKnownLocation(provider) is null. So I want to save the location when the GPS is switched off to a database. 回答1: Register a BroadcastReceiver to listen for the LocationManager's PROVIDERS_CHANGED_ACTION Intent. This will be broadcast when the GPS provider (and other providers) is enabled / disabled. 来源: https://stackoverflow.com/questions/11446428/broadcast

How to get latitude and longitude offline in android ?

一世执手 提交于 2019-12-20 03:16:09
问题 I want to get current location (latitude & longitude) , when WiFi & Gps is off .It is possible to get latitude and longitude from mobile sim network. I searched more on google but i did not get satisfies answers. 回答1: Try This LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); if(location==null){ location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } 回答2: From my

Get WikiData Identifier for city by GPS location

蹲街弑〆低调 提交于 2019-12-20 03:09:52
问题 I want to get the city /settlement at a specific gps location. meaning the closest one in a given range or at best the closest. i found some example queries in the wikimedia data examples. I try to adopt then but i get only errors or timeouts here is my current query: SELECT * WHERE { ?city wdt:P31/wdt:P279* wd:Q15642541 . // only settlements # Search by Nearest SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center "Point(8.4024875340491 48.9993762209831)"^^geo

GPsStatus switch between GPS_EVENT_STARTED and GPS_EVENT_STOPPED

坚强是说给别人听的谎言 提交于 2019-12-20 03:07:00
问题 I have somme probleme to detect GPS switch turn on/off. I can detect GPS switch on but Toasts draws always on my screen. I have "GPS enabled" "GPS disabled" "GPS enabled" "GPS disabled" "GPS enabled" "GPS disabled" "GPS enabled" ... There is my code : final LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); locationManager.addGpsStatusListener(new GpsStatus.Listener() { @Override public void onGpsStatusChanged(int event) { switch (event) {

GPS to calculate distance between two points on windows phone 7

感情迁移 提交于 2019-12-20 02:34:50
问题 i am using GPS to calculate distance between two points i.e. i am using windows phone as a tape measure but when i start i dont get the correct value infact even if i am standing still it gives me hundreds of meter here is my code myWatcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(myWatcher_StatusChanged); myWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myWatcher_PositionChanged); myWatcher.MovementThreshold = 1; void

find next postion knowing lat/lon/heading/speed

耗尽温柔 提交于 2019-12-20 02:11:08
问题 knowing a decimal latitude , decimal longitude , speed (km/h) , heading how to find the next position of a car after 60 seconds? is there any algorithm to do that? 回答1: This might help: distance_traveled = speed * time Then, calculate x and y components of speed using heading as angle (trigonometry): speed_x=distance_traveled * Math.Cos(heading/180*Math.PI) speed_y=distance_traveled * Math.Sin(heading/180*Math.PI) Next, see how to map lat/long into some form of x/y coordinates, add speed_x

find next postion knowing lat/lon/heading/speed

a 夏天 提交于 2019-12-20 02:11:06
问题 knowing a decimal latitude , decimal longitude , speed (km/h) , heading how to find the next position of a car after 60 seconds? is there any algorithm to do that? 回答1: This might help: distance_traveled = speed * time Then, calculate x and y components of speed using heading as angle (trigonometry): speed_x=distance_traveled * Math.Cos(heading/180*Math.PI) speed_y=distance_traveled * Math.Sin(heading/180*Math.PI) Next, see how to map lat/long into some form of x/y coordinates, add speed_x