为什么在集成 google+ 时将错误显示为 "unknown issue with google play service"?
why display error as "unknown issue with google play service" while google+ integration?
我正在 google+ 集成 android.I 集成所有设置,code.but 它会显示 google 播放服务未知问题错误。
我该如何解决?
我的代码如下:
google_api_client = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API,Plus.PlusOptions.builder().build())
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
您的回答将不胜感激
您需要在 Google Developers Console 中启用 Google+ API。在 API Manager
、select Credentials
下,然后是 OAuth 同意屏幕选项卡,输入所有必要的凭据。
如果您还没有在 Google Developers Console 中注册您的应用程序,请在 Developers Console 中设置一个项目和应用程序
在终端中,运行 Keytool 实用程序为您的数字签名 .apk 文件的 public 证书获取 SHA1
指纹。
keytool -exportcert -alias androiddebugkey -keystore path-to-debug-or-production-keystore -list -v
Google 驱动器 Android API 的授权由 GoogleApiClient 处理。这通常是在 activity 的 onCreate() 方法中创建的。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstance);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
创建客户端后,必须连接它才能进行授权。
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
我正在 google+ 集成 android.I 集成所有设置,code.but 它会显示 google 播放服务未知问题错误。 我该如何解决?
我的代码如下:
google_api_client = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API,Plus.PlusOptions.builder().build())
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
您的回答将不胜感激
您需要在 Google Developers Console 中启用 Google+ API。在 API Manager
、select Credentials
下,然后是 OAuth 同意屏幕选项卡,输入所有必要的凭据。
如果您还没有在 Google Developers Console 中注册您的应用程序,请在 Developers Console 中设置一个项目和应用程序
在终端中,运行 Keytool 实用程序为您的数字签名 .apk 文件的 public 证书获取 SHA1
指纹。
keytool -exportcert -alias androiddebugkey -keystore path-to-debug-or-production-keystore -list -v
Google 驱动器 Android API 的授权由 GoogleApiClient 处理。这通常是在 activity 的 onCreate() 方法中创建的。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstance);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
创建客户端后,必须连接它才能进行授权。
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}