GoogleApiClient 未配置为使用全景图

GoogleApiClient is not configured to use Panorama

当我尝试使用 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.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 但我没有找到它。

请问如何解决?

根据 GoogleApiClient.Builder 上的 Panorama documentation, you must call addApi() 并传入 Panorama.API 以使用全景 API。