gps

requestLocationUpdates throws exception

一个人想着一个人 提交于 2019-12-02 21:26:25
问题 I am creating a service that periodically updates the position. but using the following code, it throws me: runException Can't create handler inside thread that has not called Looper.prepare() This code is running inside doInBackground of Async class in service private void UpdatePosition() { locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); showPosition(location); locationListener = new

Retrieving # of satellites used in gps fix from Android

别说谁变了你拦得住时间么 提交于 2019-12-02 21:23:09
I am trying to retrieve the # of satellites used in the GPS fix. I have implemented two different methods, as shown below: package ti.utils; import android.app.Activity; import android.content.Context; import android.location.GpsSatellite; import android.location.GpsStatus; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; public class Gps { private static final int TWO_MINUTES = 1000 * 60 * 2; private static Location Location; public static int Satellites = -1; public static void StartTracking

Storing and Querying GPS Coordinates Effectively

半世苍凉 提交于 2019-12-02 21:06:35
I want to create a large database of GPS coordinates that can be queried by saying "Return all coordinates that are within 'n' metres of [this coordinate]". I need it to be as efficient as possible so looping through all the coordinates in the database and calculating whether a coordinate is within 'n' metres wouldn't be a desired solution. Is there an easier solution? Thanks I typically do this sort of query using lat/lon. Using spherical geometry, you can put a bounding box around a specific point. For example, say you have a point (X,Y) that you want all coordinates within 1 mile

Replace default GPS signal provider on Android devices

青春壹個敷衍的年華 提交于 2019-12-02 21:05:29
I would like to replace the default GPS location provider on android phones with my own coordinate source. Is there any layer/API/library/provider that would allow to be replaced with my signal provider instead of the built-in hardware GPS, or read from an external plugin? It should allow all apps that rely on the GPS service to receive my signal instead of GPS. Ideally, the replacement should still be able to access the GPS signal (for comparison/correction or to toggle between the two providers). I am thinking for example of implementing my own LocationManager, and registering it in the

How to store 800 billion GPS markers in database [closed]

丶灬走出姿态 提交于 2019-12-02 20:51:33
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I need to store GPS tracks that users record into a database. The tracks will consist of a marker every 5 meter of movement for the purpose of drawing a line on a map. I am estimating 200 km tracks which means 40,000 lnlt markers. I estimate 50,000 users

Check if 'Access to my location' is enabled - Android

安稳与你 提交于 2019-12-02 20:39:51
I have an android app that uses location. But I noticed that if users disable the 'Access to my location' in Settings > Location access, nothing works anymore. How can I check that it's enabled? In case it's disabled, how to open those settings from my app? Thanks SOLVED : String locationProviders = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if (locationProviders == null || locationProviders.equals("")) { ... startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); } Prakhar may be this will be useful check this site it discusses

GMSPolyline very large memory spike

孤者浪人 提交于 2019-12-02 19:56:09
In a GPS app that allows the user to display a list of complex location points that we call tracks on various different types of map, each track can consist of between 2k to 10k of location points. The tracks are copiously clipped, pruned and path-simplified when they are rendered on non-Google map types. This is to keep memory usage down and performance up. We typically only wind up submitting far less than a thousand (aggregate) transformed location points to the OpenGL pipeline, even in the worst cases. In integrating the Google Maps SDK for iOS, we initially attempted to continue to

How to correct smooth moving the marker in google maps v2?

北战南征 提交于 2019-12-02 19:49:08
In my application needs to display a smooth "move" google maps marker from one point to another. I use the following method for the animation: public void animateMarker(final Marker marker, final LatLng toPosition, final boolean hideMarker) { final Handler handler = new Handler(); final long start = SystemClock.uptimeMillis(); Projection proj = mMap.getProjection(); Point startPoint = proj.toScreenLocation(marker.getPosition()); final LatLng startLatLng = proj.fromScreenLocation(startPoint); final long duration = 500; final Interpolator interpolator = new LinearInterpolator(); handler.post(new

iOS augmented reality with compass and location

泄露秘密 提交于 2019-12-02 19:48:00
I'm trying to develop a mini "Around Me" like using camera, compass and location. I would like to display place's images on my screen. For the moment I have my location and my orientation with compass. I would like to know how can I determine the position of the place I want to display. Thanks for your help ;) Once you have relative distance and bearing, which you can determine from two points in the same coordinate space using algorithms found on this page , figuring out where a known coordinate is with respect to a known viewpoint is basically a perspective projection, the math is outlined

How to use both GPS and Network Provider to get current location Latitude and Longitude values in Android

六眼飞鱼酱① 提交于 2019-12-02 19:43:27
In my Android application, I want to use both the GPS provider and the network provider for location updates for 5 seconds. First, I would like to use GPS provider (because it gives accurate results), and if the GPS provider returns latitude and longitude as 0.0 and 0.0, then I want to use network provider, but I don't want to use both the providers simultaneously. Any suggestions? package loca.loca; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import