E/AndroIDRuntime(20212): java.lang.IllegalArgumentException: Googleapiclient is not configured to use the API required for this call.E/AndroIDRuntime(20212): at com.Google.androID.gms.common.internal.zzx.zzb(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.internal.zzli.zza(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.location.places.internal.zzj.getCurrentPlace(UnkNown Source)E/AndroIDRuntime(20212): at ala.youngashram.droID.com.ala.ALaActivity.getCurrentLocation(ALaActivity.java:266)E/AndroIDRuntime(20212): at ala.youngashram.droID.com.ala.ALaActivity.onConnected(ALaActivity.java:149)E/AndroIDRuntime(20212): at com.Google.androID.gms.common.internal.zzk.zzh(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.internal.zzlg.zznU(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.internal.zzlg.onConnected(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.internal.zzli.onConnected(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.common.internal.zzj$zzg.zzpf(UnkNown Source)E/AndroIDRuntime(20212): at com.Google.androID.gms.common.internal.zzj$zza.zzc(UnkNown Source)
任何建议我在这里缺少什么,我需要配置来获得这个!
更新的工作代码:感谢@ProblemSlover共享link.
mGoogleapiclient = new Googleapiclient .Builder(this) .addAPI(Places.GEO_DATA_API) .addAPI(Places.PLACE_DETECTION_API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build();
这是针对连接请求:
mGoogleapiclient.connect();
以及获取位置后,请在成功连接后调用它:
PendingResult<PlacelikelihoodBuffer> result = Places.PlaceDetectionAPI .getCurrentPlace(mGoogleapiclient,null); result.setResultCallback(new ResultCallback<PlacelikelihoodBuffer>() { @OverrIDe public voID onResult(PlacelikelihoodBuffer placelikelihoods) { for (Placelikelihood placelikelihood : placelikelihoods) { log(String.format("Place '%s' has likelihood: %g",placelikelihood.getPlace().getname(),placelikelihood.getlikelihood())); } placelikelihoods.release(); } });解决方法 请告诉我们您用于配置Googleapiclient的代码.请确保按照“入门”页面上“连接到Places API”一节中所述的正确方式完成. https://developers.google.com/places/android-api/start
这是配置剪辑:
// Your activity @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); mGoogleapiclient = new Googleapiclient .Builder(this) .addAPI(Places.GEO_DATA_API) .addAPI(Places.PLACE_DETECTION_API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); }总结
以上是内存溢出为你收集整理的android – 使用Google Place API获取当前位置全部内容,希望文章能够帮你解决android – 使用Google Place API获取当前位置所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)