I have a high priority project under development.
I am trying to insert geo location into db so I found a service online and unfortunately LocationRequest
and LocationServices.API
are not resolved.
I am using the dependency 'com.google.android.gms:play-services-maps:10.2.0'
I tried adding the imports
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 at this link
public final class LocationRequest extends Object. implements Parcelable. An encapsulation of various parameters for requesting location through FusedLocationProviderClient .
The fused location provider is a location API in Google Play services that intelligently combines different signals to provide the location information that your app needs.
FusedLocationProviderClient is for interacting with the location using fused location provider.
The Google Location Services API, part of Google Play services, is the preferred way to add location-awareness to your app. It offers a simpler API, higher accuracy, low-power geofencing, and more.
Seems like you need to compile the play-services-location
package.
Put these into the 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}"
}
Try this
implementation 'com.google.android.gms:play-services-location:15.0.1'
in your app.gradle, and update the version regularly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With