fusedlocationproviderclient

FusedLocationClient not calling onLocationResult

社会主义新天地 提交于 2021-01-26 18:01:32
问题 I'm creating a location client at the moment, currently i have public void startUpdatingLocationProcess(Context context) { parentContext = context; if (mFusedLocationClient == null){ mFusedLocationClient = LocationServices.getFusedLocationProviderClient(parentContext); LocationRequest mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(5000); mLocationRequest.setFastestInterval(5000); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); if (ContextCompat

FusedLocationProviderClient requestLocationUpdates doesn't trigger LocationCallBack for API 23 above

时间秒杀一切 提交于 2021-01-04 09:08:39
问题 I have run out of possible ways on how to solve this issue. I am technically using the same code that is working in API 23 and above before I made tweaks on my app. The callback (in the requestLocationUpdate) does not trigger in phones that are marshmallow and above (but it works fine in the emulator, tested using the Pixel 2 API 26 emulator). Take note that permission is already granted/allowed and GPS is also enabled. Also as you can see in the code below I already put a try catch and still

FusedLocationProviderClient getLastLocation elapsedRealtimeNanos mostly current system time

ε祈祈猫儿з 提交于 2020-05-14 19:50:14
问题 Update 2 I had a talk with a google engineer on Google I/O '18. He told me that I can trust the fusedLocationProvider. If he marks the last known location with a new timestamp the user is probably still at the same location. I'd like to do a few tests with a "moving" device in the future to prove this statement. Original Question I'm requesting the last known location from the FusedLocationProviderClient with getLastLocation() and want to check if the last known location is older than 5

Not Able To Upgrade Gps settings to high Accuracy using FusedLocationProvider In some devices

时光怂恿深爱的人放手 提交于 2019-12-24 10:50:17
问题 I am using SettingsApi and FusedLocationProvider to upgrade Gps settings and getting location updates, I want High accuracy location updates for that I am showing Turn on gps dialog using SettingsApi to upgrade GPS settings to High Accuracy but in some devices (like Mi and Gionee) even if the user has clicked OK button in Turn On Gps Dialog I am getting RESULT_CANCELED on onActivityResult while everything is working perfectly fine in other devices like Motorola, Lenovo When User is Clicking

How to remove FusedlocationProviderClient location updates from within non-activity class

倖福魔咒の 提交于 2019-12-12 19:17:03
问题 I’m trying to write a utility class to wrap the Google Play Services FusedLocationProviderClient API and location permissions request as I’m sick of writing all that boilerplate every time I want to add location functionality to an app. The problem I’m having though is I’m unable to remove location updates once I’ve started them. Here’s the relevant bits of my utility class: public class UserLocationUtility extends LocationCallback { // Hold a WeakReference to the host activity (allows it to

FusedLocationProviderClient - type or namespace could not be found (error)

痴心易碎 提交于 2019-12-11 09:02:07
问题 So sorry if this is really simple (also failing to install google play services on Marshmallow emulator, and getting a tad wound up!). I am aiming to get GPS data in a Xamarin Android C# project on Visual Studio 2017 (15.6.3). I am following the Xamarin Location Services walkthrough (https://docs.microsoft.com/en-gb/xamarin/android/platform/maps-and-location/location#using-the-fused-location-provider) and source code examples. I have tried targeting Android 6.0 (my preferred) and also 7.1 and

LocationCallback not getting called

给你一囗甜甜゛ 提交于 2019-12-10 01:31:44
问题 I am making a location request using FusedLocationProviderClient . I have kept a timer for 30 seconds to check if location is received within that timeframe. Code is below: public void requestLocationUpdates() { initializeLocationRequest(); mFusedLocationProviderClient.requestLocationUpdates(mLocationRequest, mLocationCallback, null); startTimer(); } private void initializeLocationRequest() { mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(mContext);

FusedLocationAPI can not remove location updates through AlarmManager

大兔子大兔子 提交于 2019-12-08 05:57:37
问题 I have created simple class to get updated location using google's FusedLocationProviderClient . i.e.: public class LocationProvider extends LocationCallback {... private static FusedLocationProviderClient mFusedLocationClient; private LocationRequest mLocationRequest; if(mFusedLocationClient == null) { mFusedLocationClient = LocationServices.getFusedLocationProviderClient(mContext); mFusedLocationClient.requestLocationUpdates(mLocationRequest, locationCallback, null /* Looper */); }..} Now,

Wierd and very unexpected issue with location.getAccuracy()

谁都会走 提交于 2019-12-02 07:32:31
问题 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

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