1

I have compileSdkVersion 32 and now I can create LocationRequest only using LocationRequest.Builder. LocationRequest.create() currently unavailable, means I can't even call this deprecated static method. So any suggestions how to create LocationRequest for API lower than 31? Thanks.

Konstantin Konopko
  • 5,229
  • 4
  • 36
  • 62

3 Answers3

1

You cannot create a LocationRequest on API Level 30 and below, because LocationRequest itself was added in API Level 31.

You should be able to use LocationRequestCompat as a backwards-compatible replacement, used with LocationManagerCompat.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Solved with using com.google.android.gms.location.LocationRequest

Konstantin Konopko
  • 5,229
  • 4
  • 36
  • 62
0

Update location service library to the late version and use correct import, for me the latest version right now is

implementation 'com.google.android.gms:play-services-location:21.0.1'

this version may have been changed when you will be seeing this answer, so make sure to update to the latest version.

Anish Vahora
  • 243
  • 3
  • 10