gps

GPS Application crash

人盡茶涼 提交于 2019-12-13 05:10:58
问题 I have to write an application which does several things, including recording the GPS location of the user when a correct username and password is entered. I only want the latitude and longitude at that exact moment, no recurring checks or anything of that nature. I think I found something similar to what I was looking for: How to call to get a single gps fix when ever i want android? However, eclipse didn't like the context since I hadn't initialized it yet. So here is that entire section of

'Sleep' issue with GPS location updates on some devices

旧城冷巷雨未停 提交于 2019-12-13 05:02:37
问题 I have an app that uses GPS for regular updates. It used to be the case that when the device was put to sleep (screen turned off, screen timeout etc), the location updates kept on coming through. This was on an HTC Desire running 2.2. I need that behaviour for various reasons. However, now being tested on an HTC Desire S running 4.0.4, and what seems to happen is that updates continue (1/sec) for about 5 seconds after entering sleep mode, but then stop. However, exactly the same code running

Scale coordinates on radar

扶醉桌前 提交于 2019-12-13 04:47:10
问题 I'm currently developing an radar for android. (Following this tutorial: http://www.androidph.com/2009/02/app-10-beer-radar.html ) I'm getting all users within a range of 5KM around my current location from the server after that I draw in my customview like this: float xU = (float)(userLocation.getLongitude() + getWidth() / 2 - currentLong); float yU = (float)(getHeight() / 2 - userLocation.getLatitude() + currentLat); canvas.drawBitmap(bmpUser,xU,yU,radarPaint); Now my problem is, that I

Does Google Location Services return old locations?

本小妞迷上赌 提交于 2019-12-13 04:37:43
问题 I am trying to track my location every 2 mins to check the distance from me to my house. However the results I have been getting have been odd. When I would travel about 700 meters away (to another building) and stay there for 2 hours the results would say that I was always within 40 meters of my home. They would change but the distance never got bigger than that. private void locationSetup(){ int interval = 120000; // Create the LocationRequest object mLocationRequest = LocationRequest

How to excute AsyncTask inside onLocationChanged() method in Android

≡放荡痞女 提交于 2019-12-13 04:33:53
问题 I have class that extends AsyncTask class and I create instance of this class of this AsyncTask class uses data comes from GPS driver from the method public void onLocationChanged(Location location) {} from interface LocationListener . I want to know why why the application to execute AsyncTask instance inside the method onLocationChanged() ?! As I want to execute something in background only when the location is changed 回答1: public void onLocationChanged(Location location) { new

Determine if a GPS location is within a gpx track segment

谁说我不能喝 提交于 2019-12-13 03:44:53
问题 I have this .gpx file that is formatted as follows: <trk> <name>Area1</name> <extensions> <gpxx:TrackExtension> <gpxx:DisplayColor>Magenta</gpxx:DisplayColor> </gpxx:TrackExtension> </extensions> <trkseg> <trkpt lat="52.806521779700120" lon="5.795177063346190"/> ... <trkpt lat="52.806521779700120" lon="5.795177063346190"/> </trkseg> </trk> <trk> <name>Area2</name> <extensions> <gpxx:TrackExtension> <gpxx:DisplayColor>Magenta</gpxx:DisplayColor> </gpxx:TrackExtension> </extensions> <trkseg>

Android - Know when user turns to left or right

旧时模样 提交于 2019-12-13 03:23:55
问题 I am making a GPS-Like App and I need to know when the user turns left or right (his heading) to change the rotation of the position marker. I've tried this and this But none of them is working, the first one just randomly changes even if I haven't totally turned and the second one just works if you change the device from horizontal to vertical or viceversa. Can someone give me a hand please? Thanks. 来源: https://stackoverflow.com/questions/52626704/android-know-when-user-turns-to-left-or

Retrieve closest road when given (lat, long) using OSM in Postgres with Postgis using SQL query

偶尔善良 提交于 2019-12-13 03:14:30
问题 Given a set (lat, long) I am trying to find the maximum speed using "max_speed" and street type using "highway". I have loaded my database (Postgres and Postgis) as follows: $ osm2pgsql -c -d gis --slim -C 50000 /var/lib/postgresql/data/germany-latest.osm.pbf The closest related question I could find was How to query all shops around a certain longitude/latitude using osm-postgis?. I have taken the query, and plugged in a (lat, long) that I found in google maps for the city center of Munich

Android: distanceTo() wrong values

只愿长相守 提交于 2019-12-13 03:05:54
问题 I am writing an application for tracking my route. I am requesting updates from GPS every minute and it works fine. It shows me my exact point. When I want to calculate distance between current point and previous one it works ok, but form time to time it calculates distance totaly wrong (I moved about 200m and it retuned me a value over 10km). Does anyone know why this could happen? Here is the function which I use: iRoute += myGPSLocation.distanceTo(prevLocation); Thanks in advance! 回答1:

android LocationListener not stopping GPS use

笑着哭i 提交于 2019-12-13 02:54:34
问题 In my service , in some scenarios I can't stop the GPS from searching and draining the device battery. LocationListenerAgent.java @Override public void onCreate() { thisContext = this; // Register ourselves for location updates networkListener = new LocationListenerAgent(); gpsListener = new LocationListenerAgent(); lmgrNet = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE); lmgrGps = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE); gps_enabled = lmgrGps