当我尝试使用时Panorama.PanoramaApi.loadPanoramaInfo()
,我得到以下错误:
09-19 18:30:30.009 18751-18751/com.my.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.my.example, PID: 18751
java.lang.IllegalArgumentException: GoogleApiClient is not configured to use the API required for this call.
at com.google.android.gms.common.internal.zzab.zzb(Unknown Source)
at com.google.android.gms.internal.zzpy.zzc(Unknown Source)
at com.google.android.gms.internal.zzuw.loadPanoramaInfo(Unknown Source)
at com.ndguide.imageslideshow.adapter.poiSlideAdapter$1.onClick(poiSlideAdapter.java:62)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21153)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我的代码是
if (uri != null) {
Panorama.PanoramaApi.loadPanoramaInfo(site.getGoogleApiClient(), uri).setResultCallback(
new ResultCallback<PanoramaResult>() {
@Override
public void onResult(PanoramaResult result) {
if (result.getStatus().isSuccess()) {
Intent viewerIntent = result.getViewerIntent();
Log.i(Constants.APP_TAG, "found viewerIntent: " + viewerIntent);
if (viewerIntent != null) {
site.getMainActivity().startActivity(viewerIntent);
}
} else {
Log.e(Constants.APP_TAG, "error: " + result);
}
}
}
);
}
我知道我必须去 Google API 控制台才能启用全景 API,但我没有找到它。
请问怎么解决?