LocationRequest and LocationServices.API not allowed

I am developing a high priority project.
I'm trying to insert the location of the geodata in the db, so I found the online service, and, unfortunately, LocationRequestand LocationServices.APInot allowed.
I am using addiction'com.google.android.gms:play-services-maps:10.2.0'

enter image description here

I tried to add import

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;

You can find the code I used in this link

+4
source share
1 answer

It looks like you need to compile the package play-services-location.

Put them in build.gradle

ext {
    playServicesVersion = '10.2.0' // update accordingly 
}

dependencies {
    ...
    compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
    compile "com.google.android.gms:play-services-location:${playServicesVersion}"
}
+13
source

Source: https://habr.com/ru/post/1671854/


All Articles