fusedlocationproviderapi

Wierd and very unexpected issue with location.getAccuracy()

倾然丶 夕夏残阳落幕 提交于 2019-12-02 06:56:57
Problem: I have tried using the new FusedLocationProviderClient and the deprecated FusedLocationApi to receive location updates on my app using a Sony Xperia Z2 and Huawei Honor 8 . Everything works fine initialy. However it seems that after x amount of location requests the accuracy number NEVER drops below 10.0 using location.getAccuracy(); // 10.0 What I have tried: Uninstalling and reinstalling the app does no difference. Restarting the phone, same result. Yes I have LocationRequest.PRIORITY_HIGH_ACCURACY ... no different result. What might have worked: Did a factory reset. Whooppaa

Clear fused location provider's location for testing

情到浓时终转凉″ 提交于 2019-12-02 01:30:41
I would like to know if it is possible to clear the "location" that is stored by play service's fused location API. When testing my app on a real device, I would like to recreate few scenarios and that's the reason I would like to know if this is possible. I tried to clear "Google Play Services" cache and data. But, it does not seem to help me. Location still seems to be cached somewhere. Google Play Services is central service and serves every app installed on your device. After clearing cache and data, if any app connects with Google Play services on that device(which almost every Google app

sending extra to requestLocationUpdates intentService breaks location updates

戏子无情 提交于 2019-11-30 03:58:24
I'm having trouble sending a string extra with my PendingIntent that I pass to LocationServices.FusedLocationApi.requestLocationUpdates(GoogleApiClient client, LocationRequest request, PendingIntent callbackIntent) . It appears that the username extra i'm putting onto the Intent is mangling the location that requestLocationUpdates is trying to hand off to my IntentService as intent.getParcelableExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED) returns null . EDIT I've tried making a User class that implements Parcelable and putting it as an extra: mRequestLocationUpdatesIntent.putExtra(

android check if user turned off location

旧街凉风 提交于 2019-11-29 16:02:47
I am building an application in which I have to constantly save user's location and then send it to the server. For that, I am using FusedLocationApis in a service. For the first time, I am asking user to turn on locations. It is working perfectly. Now, what if the user unintentionally turns off the location. How should I inform him? Do developers have to take care of this or they just leave it to the user? I thought of giving him an android notification for this. For that, I need to constantly check our locations enabled in the service. I have a working code for that (function

sending extra to requestLocationUpdates intentService breaks location updates

时光总嘲笑我的痴心妄想 提交于 2019-11-29 01:38:40
问题 I'm having trouble sending a string extra with my PendingIntent that I pass to LocationServices.FusedLocationApi.requestLocationUpdates(GoogleApiClient client, LocationRequest request, PendingIntent callbackIntent) . It appears that the username extra i'm putting onto the Intent is mangling the location that requestLocationUpdates is trying to hand off to my IntentService as intent.getParcelableExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED) returns null . EDIT I've tried making a User

android check if user turned off location

試著忘記壹切 提交于 2019-11-28 09:23:18
问题 I am building an application in which I have to constantly save user's location and then send it to the server. For that, I am using FusedLocationApis in a service. For the first time, I am asking user to turn on locations. It is working perfectly. Now, what if the user unintentionally turns off the location. How should I inform him? Do developers have to take care of this or they just leave it to the user? I thought of giving him an android notification for this. For that, I need to

Fused Location Provider setsmallestDisplacement doesn't work in Android

╄→尐↘猪︶ㄣ 提交于 2019-11-28 06:25:44
Hi I have implemented Fused Location provider Api for getting location updates in a service. I was able to get the onlocationchanged event fired according to the interval set. However when i set the setsmallestDisplacement to 10 metres, the event is getting fired even if the device is still. Does any one have problem similar to this. please provide suggestions. Below is the code mlocationrequest = LocationRequest.create(); mlocationrequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); mlocationrequest.setInterval(60000); // Update location every 1 minute mlocationrequest

Why does FusedLocationProviderApi never report accuracy better than 10m? Is this documented?

陌路散爱 提交于 2019-11-28 05:14:46
问题 A data collection app that used LocationManager directly was updated to use FusedLocationProviderApi . With LocationManager , most devices quickly report 5m accuracy or better when collecting location. With FusedLocationProviderApi , the best accuracy ever reported is 10m. I have just installed a location demo app and see the same behavior (https://github.com/will-quast/android-location-demo). In the Fused Location activity, if I only show GPS location, the accuracy changes as I get a better

Why is FusedLocationApi.getLastLocation null

纵饮孤独 提交于 2019-11-27 07:34:33
I am trying to get location by using FusedLocationApi.getLastLocation and I've got the location permissions in the manifest file: <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> However, I am getting null when I request the location from the system. I was just testing turning off and on location services so it may be related to that (of course, it's ON when I'm trying this). But even after returning null, I'm waiting for onLocationChanged to be called and it's never called. I've also seen a

Fused Location Provider: Is there a way to check if a location update failed?

别来无恙 提交于 2019-11-27 05:45:05
问题 Introduction In my app I want to get a one-off accurate location of where the user currently is. When I used FusedLocationProviderApi.getLastLocation sometimes this would be null or out of date location because I found out this just gets a cached location and does not request a new location update. The solution was to request a location update only once as seen below. LocationRequest locationRequest = LocationRequest.create() .setNumUpdates(1) .setPriority(LocationRequest.PRIORITY_HIGH