Questions tagged «google-api-client»

6
使用Postman访问OAuth 2.0 Google API
我正在尝试使用Postman chrome应用程序访问Proximity Google API。我已经按照邮递员和Google开发人员网站上的教程进行操作,但是仍然收到401错误消息。 我在做什么? 第1步-启用接近API: 为了使用Proximity API,必须首先在Google Dev控制台中启用它。使用本教程,我为我的项目启用了对Proximity API的支持 第2步-获取凭据: 根据本教程,我需要获取客户端ID和密码。这就是我感到困惑的地方。凭据->添加凭据-> OAuth2.0客户端ID->选择Chrome App单选按钮(因为我使用的是Postman)->输入Postman的Chrome Web商店URL的最后一部分[ fhbjgbiflinjbdggehcddcbbddddop] ->点击创建按钮这些步骤将只生成一个客户端ID,而不是一个秘密。.我做错什么了吗? 您可以从Google Dev控制台下载一个JSON文件,其中包含客户端ID,身份验证URI和令牌URI 我下载了此文件,但是如果我使用的是Postman,则无济于事。我猜这个JSON文件可以包含在JS应用程序中。 第3步-使用Postman测试API 我得到什么? 而且,一旦我点击了调试网址,就会看到以下屏幕

9
在调用onConnected函数之后,GoogleApiClient抛出“ GoogleApiClient尚未连接”
因此,我发现关于GoogleApiClient的事情我不太清楚。 GoogleApiClient具有称为onConnected的功能,该功能在客户端连接时运行(确定)。 我有自己的函数:startLocationListening,最终在GoogleApiClient的onConnected函数上被调用。 因此,如果没有GoogleApiClient连接,我的startLocationListening函数将无法运行。 代码和日志: @Override public void onConnected(Bundle bundle) { log("Google_Api_Client:connected."); initLocationRequest(); startLocationListening(); //Exception caught inside this function } ... private void startLocationListening() { log("Starting_location_listening:now"); //Exception caught here below: LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); } 例外是: 03-30 12:23:28.947: E/AndroidRuntime(4936): java.lang.IllegalStateException: GoogleApiClient is not connected yet. 03-30 12:23:28.947: E/AndroidRuntime(4936): at com.google.android.gms.internal.jx.a(Unknown Source) …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.