Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In my app I am not receiving speed in location object in Moto G 3rd generation Android 6.0 mobile

In my app I am using FusedLocation.API for location updates, and I am using google play services-7.8.0. In onLocationChange() method, in location object i am not getting speed in Moto G(3rd Gen) Android 6.0. In all other mobiles I am able to receive speed. I tried with google play service versions 8.4.0 and 9.0.2 but no luck!

mLocationRequest = LocationRequest.create();
        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
        mLocationRequest.setInterval(0);
        mLocationRequest.setFastestInterval(0);

LocationServices.FusedLocationApi.requestLocationUpdates(mLocationClient, mLocationRequest, mLocationListener);

Can anyone please tell what could be the problem for this issue and how to overcome this issue ?

I am targeting for SDK 21 and also my compile SDK version is 21

Thanks in advance!

like image 954
Renadh Avatar asked Nov 09 '22 13:11

Renadh


1 Answers

In marshmallow and higher location is considered a "Dangerous permission" Here's the article for google. https://developer.android.com/training/permissions/requesting.html

there's several third party libraries to help manage permissions

https://android-arsenal.com/tag/235

also make sure your permissions are declared in your manifest.xml

like image 170
Danny Beaumont Avatar answered Nov 15 '22 12:11

Danny Beaumont