android-gps

Getting location offline

橙三吉。 提交于 2019-12-01 08:44:01
I want to get the value of Longitude and Latitude of my current locatoin when offline and save the current location to its database. Is it possible to get the longitude and latitude of the device when mobile data and wifi are off but the GPS is ON? Just use this code. Make sure the user hasn't selected wifi only or network only option in his location setings. it has to be high accuracy or GPS only. This piece of code will work. public class Location extends AppCompatActivity { LocationManager locationManager; Context mContext; @Override protected void onCreate(Bundle savedInstanceState) {

How can I extrapolate farther along a road?

若如初见. 提交于 2019-11-29 07:35:15
Given realtime location data of a moving device over a short period of time, how can I get a lat/long pair further along this road, say, 2 miles, or even better, 5 minutes worth of driving? I see that I can use Google's Roads API to snap to a road given a lat/long pair https://developers.google.com/maps/documentation/roads/snap , but that only gets me part way there. This will be in an Android app. Given a route represented as a List<LatLng> , this function calculates the point on the route that results from travelling distance meters from origin on that route (using the Google Maps API

When do I need android.hardware.location.gps and android.hardware.location.network?

核能气质少年 提交于 2019-11-28 18:51:27
问题 Google is informing by email of changes to the Android location permissions: We’re making a change on October 15th, 2016 that will affect apps targeting API version 21 (Android 5.0, Lollipop) or higher that use ACCESS_FINE_LOCATION but don't explicitly have the "android.hardware.location.gps" uses-feature. Going forward, these apps will be available to install on devices that don't have GPS hardware. In most cases this won't be an issue since Wi-Fi and Cell-ID based location provides high

onLocationChanged() is never trigered by requestLocationUpdate() - Android

廉价感情. 提交于 2019-11-28 12:55:48
问题 I have used manager.requestLocationUpdates("gps", 1000, 0, new LocationDetector()); to get update after every second. But this method is never triggering onLocationChanged() method. I have run my application many times, and I have also tried to wait up to 30 minutes for getting update, but no update is being displayed on Android Monitor. I have also double checked my device's GPS which is ON. So Kindly tell what can be the problem? Code: public class LocationDetector implements

FusedLocationApi Performance Issue: Accuracy seems capped at 10.0 meters

两盒软妹~` 提交于 2019-11-28 11:44:30
I'm experiencing a strange problem where the FusedLocationProviderAPI does not give me a better Accuracy number then 10.0 meters. It starts like normal giving me a high number of, for example, 56 meters... 24... 13... and then stays at 10.0. Seemingly capped at giving no better then that. Tried on Phone Sony Xperia Z2 & Huawei Honor 8 location.getAccuracy() //Seems capped at 10.0 meters The strange part is that I was receiving an Accuracy number down to around 3.0 meters with good weather outside and I have no memory of changing the phones GPS options / nor any options related to the GPS

Android: Can I enable the GPS without redirecting the user to the settings screen like in “google maps” app

北城余情 提交于 2019-11-28 04:46:09
In GPS based applications, it is important that the user enable his GPS. If not then usually we would show a dialog stating that the user " should enable his GPS from the settings to be able to use this functionality ". When the user press OK he will be redirected to the Settings page, I don't like this solution since it takes the user out of the application context in to the settings. I have noticed that "google maps" application has a better solution, which is to show a neat dialog when a GPS feature is needed. Upon the user's selection "OK" GPS will be enabled directly without any

How can I extrapolate farther along a road?

心不动则不痛 提交于 2019-11-28 01:32:49
问题 Given realtime location data of a moving device over a short period of time, how can I get a lat/long pair further along this road, say, 2 miles, or even better, 5 minutes worth of driving? I see that I can use Google's Roads API to snap to a road given a lat/long pair https://developers.google.com/maps/documentation/roads/snap, but that only gets me part way there. This will be in an Android app. 回答1: Given a route represented as a List<LatLng> , this function calculates the point on the

FusedLocationApi Performance Issue: Accuracy seems capped at 10.0 meters

守給你的承諾、 提交于 2019-11-27 06:29:22
问题 I'm experiencing a strange problem where the FusedLocationProviderAPI does not give me a better Accuracy number then 10.0 meters. It starts like normal giving me a high number of, for example, 56 meters... 24... 13... and then stays at 10.0. Seemingly capped at giving no better then that. Tried on Phone Sony Xperia Z2 & Huawei Honor 8 location.getAccuracy() //Seems capped at 10.0 meters The strange part is that I was receiving an Accuracy number down to around 3.0 meters with good weather

Android: Can I enable the GPS without redirecting the user to the settings screen like in “google maps” app

烂漫一生 提交于 2019-11-27 00:38:52
问题 In GPS based applications, it is important that the user enable his GPS. If not then usually we would show a dialog stating that the user " should enable his GPS from the settings to be able to use this functionality ". When the user press OK he will be redirected to the Settings page, I don't like this solution since it takes the user out of the application context in to the settings. I have noticed that "google maps" application has a better solution, which is to show a neat dialog when a

Get current location of user in Android without using GPS or internet

Deadly 提交于 2019-11-26 12:02:36
Is it possible to get the current location of user without using GPS or the internet? I mean with the help of mobile network provider. What you are looking to do is get the position using the LocationManager.NETWORK_PROVIDER instead of LocationManager.GPS_PROVIDER . The NETWORK_PROVIDER will resolve on the GSM or wifi, which ever available. Obviously with wifi off, GSM will be used. Keep in mind that using the cell network is accurate to basically 500m. http://developer.android.com/guide/topics/location/obtaining-user-location.html has some really great information and sample code. After you