如何在打开应用程序时连接 Google Play 服务?
How to connect Google Play Services when the app is opened?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.ana_sayfa);
apiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.e("HATA", "Google Play Oyun servisine bağlanamadı.Lütfen bağlantınızı kontrol ediniz.");
finish();
}
}).build();
}
我希望用户在应用程序 opened.I 时登录 google 播放服务出现以下错误。
java.lang.IllegalStateException: A fatal developer error has occurred. Class name: zzf. Start service action: com.google.android.gms.games.service.START. Service Descriptor: com.google.android.gms.games.internal.IGamesService. at com.google.android.gms.common.internal.BaseGmsClient$zza.zza(Unknown Source:20) at com.google.android.grns.common.internal.BaseGmsClient$zzc.zzo(Unknown Source:11) at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(Unknown Source:48) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looperloop(Looperjava:164) at android.app.ActivityThread.main(ActivityThread.java:6696) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCallerrun(Zygote.java:240) at com.android.internal.os.Zygotelnit.main(Zygotelnit.java:782)
我解决了problem.I没有在manifest文件中添加以下代码
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.ana_sayfa);
apiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
.enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.e("HATA", "Google Play Oyun servisine bağlanamadı.Lütfen bağlantınızı kontrol ediniz.");
finish();
}
}).build();
}
我希望用户在应用程序 opened.I 时登录 google 播放服务出现以下错误。
java.lang.IllegalStateException: A fatal developer error has occurred. Class name: zzf. Start service action: com.google.android.gms.games.service.START. Service Descriptor: com.google.android.gms.games.internal.IGamesService. at com.google.android.gms.common.internal.BaseGmsClient$zza.zza(Unknown Source:20) at com.google.android.grns.common.internal.BaseGmsClient$zzc.zzo(Unknown Source:11) at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(Unknown Source:48) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looperloop(Looperjava:164) at android.app.ActivityThread.main(ActivityThread.java:6696) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCallerrun(Zygote.java:240) at com.android.internal.os.Zygotelnit.main(Zygotelnit.java:782)
我解决了problem.I没有在manifest文件中添加以下代码
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />