2ndGAB 2ndGAB - 2 months ago 33
Android Question

GoogleApiClient is not configured to use Panorama

When I try to use

Panorama.PanoramaApi.loadPanoramaInfo()
, Iget the following error:

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)


My code is

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);
}
}
}
);
}


I understood that I had to go to the Google API Console to enable Panorama API but I didn't find it.

How to solve it please?

Answer

Per the Panorama documentation, you must call addApi() on your GoogleApiClient.Builder and pass in Panorama.API to use the Panorama APIs.

Comments