gps

Enable GPS in a device owner app

最后都变了- 提交于 2019-12-01 09:55:34
问题 According API documentation a device owner app can modify a few "secure settings" and specially the LOCATION_MODE with the following call : devicePolicyManager.setSecureSetting (ComponentName admin, String setting, String value) Called by profile or device owners to update Settings.Secure settings [...] A device owner can additionally update the following settings: LOCATION_MODE According my understanding the value of LOCATION_MODE is an int (resp. 0 for location disabled, 1 for GPS only, 2

Latitude and Longitude showing as 0 in Android

▼魔方 西西 提交于 2019-12-01 09:29:29
************* TrackGPS.java ***************************** import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import android.support.v4.app.ActivityCompat; import android.util.Log; import android.widget.Toast; /** * Created by ANQ on 8/8/2016.

Android runtime permissions on android versions below M?

早过忘川 提交于 2019-12-01 09:25:28
Recently my ola cabs application , after the latest update, asked for location permission at runtime. It did not open the location settings screen but just by clicking on yes, my location (GPS) of the device was turned on and the application proceeded without going to location settings or any settings screen. This feature was about to come in android M and is available on the MNC preview only, so I am guessing it cannot be used in devices at this point of time. So how is this application implementing this feature? It is using SettingsApi in the Play Services SDK 7.0+, to display the location

iPhone GPS Accuracy

◇◆丶佛笑我妖孽 提交于 2019-12-01 09:18:05
as I am developing for iPhone, I've just bought an iPhone 4 to test my application which needs to measure the coordinates of my location. I don't have any Internet (3GS, GPRS or whatever...) on my iPhone and the problem is: 1) Without internet I get a 1744m horizontal accuracy, and that's very bad. (I've also tested the accuracy in other applications too, and it is always as bad or worse) 2) With WiFi-Internet I get a 80m horizontal accuracy. Is that normal? What can I do to improve my coordinates-measurement accuracy? Thanks in advance for any help. From my experience you need cellular data

How to handle that the application is minimized by HOME button

99封情书 提交于 2019-12-01 09:15:30
问题 An issue has appeared a few days ago. I have an application that listen for GPS location. The listener is a background service that works all the time, this service saves data in application level and each activity reads this data. So, when i press back button i am able to catch this event and i can stop the service, but when i press HOME button the service is still working although the application is in background mode and this consumes battery, because the GPS always works. How can i handle

Automatically turn on GPS

可紊 提交于 2019-12-01 08:54:50
问题 I googled about it and there were solutions regarding the exploitation of Power Manager Bug to resolve this issue. But as the bug has now been solved. So how can now I solve this issue of starting the GPS when the app starts? Please help. 回答1: Use this function : 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

Android - Network Date/Time

旧巷老猫 提交于 2019-12-01 08:37:26
I'm in the process of writing an app for Android. I need to allow my users to capture their current location & log the date/time that this happened. The catch is that the date/time cannot be something that the user can change by adjusting the date/time on their device. Can you point me in the right direction for obtaining the Cellular Network date/time when using location services for towers, and also how to obtain the GPS date/time. Any help is appreciated, thank you! Sean Barbeau GPS or Network timestamp can be retrieved by using the LocationListener in the Android Location API. See the open

Interpolate between 2 GPS locations based on walking speed

走远了吗. 提交于 2019-12-01 08:28:58
问题 Problem: Given two locations: L 1 = (latitude 1 , longitude 1 , timestamp 1 ) , L 2 = (latitude 2 , longitude 2 , timestamp 2 ) , and a configurable, but constant, movement speed: v = 1.39 meters per second (for instance). How can we interpolate between these two locations to estimate a users location as he travels from L 1 to L 2 ? I have been searching for solutions to this problem and so far I have found, that for small distances (away from the poles) linear interpolation can be used. So,

Time based GPS location in background (iphone)

天大地大妈咪最大 提交于 2019-12-01 08:25:39
问题 I want to create an (game based) iPhone application which sends your GPS location on a specific time (like 3-5 times a day) to a server. I found an apple page explaining some functionality to run in the background like location, music and VOIP. I need the GPS to be accurate on the meter. Can someone help me with a small example? 回答1: It really depends on your usage of the location. If you monitor actively, kiss the battery of your user goodbye. Very detailed accuracy, even bigger hit to

Android draw a path on a mapView from a large amount of longitude/latitude points

纵饮孤独 提交于 2019-12-01 08:13:03
I am writing a application that needs to draw a "route" comprised of lots of GPS points (long+lat). The points are close together and don't follow roads, simply drawing a line between each point is ideal. The current implementation I have is very slow as I am looping over all the GPS coordinates and creating a new Point and overlayitem in an itemized overlay. This takes around 20 seconds for it to load all of these points and draw them to the mapview. Is there a way in which I can construct a series of lines or point from the GPS coordinates and draw them onto the mapview? Example of current