不推荐使用getPlaceDetectionClient(android.app.Activity,com.google.android.gms.location.places.PlacesOptions)

Mik*_*Lin 3 android google-places-api

Android Studio 3.1.4

placeDetectionClient = Places.getPlaceDetectionClient(this, null);
Run Code Online (Sandbox Code Playgroud)

给出错误:

getPlaceDetectionClient(android.app.Activity, com.google.android.gms.location.places.PlacesOptions) is deprecated
Run Code Online (Sandbox Code Playgroud)

任何想法使用什么代替?谢谢

The*_*rer 6

你读过API参考了吗?

getPlaceDetectionClient(Context context, PlacesOptions options)已被取代getPlaceDetectionClient(Context context).只需删除null参数即可.

那也不是错误.这是一个警告,可以安全地忽略调试目的.