I used the google demo example TypeANumber from developer.android.com/training. I configured the app correctly in the play.google.com developer console, even published it, configured as well correctly the game service TypeANumber in the developer console and linked the previous mentioned app, even published the service and I still keep getting the resultCode 10004 which stands for
public static final int RESULT_APP_MISCONFIGURED Result code sent back to the calling Activity when the game is not properly configured to access the Games service. Developers should check the logs for more details. Constant Value: 10004 (0x00002714)
Used code is:
package com.sitewalk.typeanumber;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.common.AccountPicker;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
public class GooglePlayServicesActivity extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private static final String TAG = "GooglePlayServicesActivity";
private static final String KEY_IN_RESOLUTION = "is_in_resolution";
private static final String DIALOG_ERROR = "dialog_error";
private static final int REQUEST_RESOLVE_ERROR = 1001;
private GoogleApiClient mGoogleApiClient;
private boolean mIsInResolution;
private boolean mResolvingError=false;
private static final String STATE_RESOLVING_ERROR = "resolving_error";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.addScope(Games.SCOPE_GAMES)
// Optionally, add additional APIs and scopes if required.
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
mResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
}
@Override
protected void onStart() {
super.onStart();
if (!mResolvingError) { // more about this later
mGoogleApiClient.connect();
}
}
@Override
protected void onStop() {
if (mGoogleApiClient != null) {
mGoogleApiClient.disconnect();
}
super.onStop();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(KEY_IN_RESOLUTION, mIsInResolution);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_RESOLVE_ERROR) {
mResolvingError = false;
if (resultCode == RESULT_OK) {
// Make sure the app is not already connected or attempting to connect
if (!mGoogleApiClient.isConnecting() && !mGoogleApiClient.isConnected()) {
mGoogleApiClient.connect();
}
}
}
}
private void retryConnecting() {
mIsInResolution = false;
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
}
@Override
public void onConnected(Bundle connectionHint) {
Log.i(TAG, "GoogleApiClient connected");
startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient), 5638676);
}
@Override
public void onConnectionSuspended(int cause) {
Log.i(TAG, "GoogleApiClient connection suspended");
retryConnecting();
}
@Override
public void onConnectionFailed(ConnectionResult result) {
if (mResolvingError) {
// Already attempting to resolve an error.
return;
} else if (result.hasResolution()) {
try {
mResolvingError = true;
result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
} catch (SendIntentException e) {
// There was an error with the resolution intent. Try again.
mGoogleApiClient.connect();
}
} else {
// Show dialog using GooglePlayServicesUtil.getErrorDialog()
showErrorDialog(result.getErrorCode());
mResolvingError = true;
}
}
/* Creates a dialog for an error message */
private void showErrorDialog(int errorCode) {
// Create a fragment for the error dialog
ErrorDialogFragment dialogFragment = new ErrorDialogFragment();
// Pass the error that should be displayed
Bundle args = new Bundle();
args.putInt(DIALOG_ERROR, errorCode);
dialogFragment.setArguments(args);
dialogFragment.show(getFragmentManager(), "errordialog");
}
/* Called from ErrorDialogFragment when the dialog is dismissed. */
public void onDialogDismissed() {
mResolvingError = false;
}
/* A fragment to display an error dialog */
public static class ErrorDialogFragment extends DialogFragment {
public ErrorDialogFragment() { }
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Get the error code and retrieve the appropriate dialog
int errorCode = this.getArguments().getInt(DIALOG_ERROR);
return GooglePlayServicesUtil.getErrorDialog(errorCode,
this.getActivity(), REQUEST_RESOLVE_ERROR);
}
@Override
public void onDismiss(DialogInterface dialog) {
((GooglePlayServicesActivity)getActivity()).onDialogDismissed();
}
}
}
as well a correct AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sitewalk.typeanumber" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GooglePlayServicesActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
</application>
</manifest>
with the correct APP-ID (checked digit after digit), and a build.gradle containing the play-services dependencies:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.sitewalk.typeanumber"
minSdkVersion 14
targetSdkVersion 21
versionCode 2
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
}
Logcat is not telling me any infos regarding the 10004 codeResult:
01-28 11:10:54.735 31182-31182/com.sitewalk.typeanumber D/dalvikvm﹕ Late-enabling CheckJNI
01-28 11:10:54.755 31182-31188/com.sitewalk.typeanumber D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
01-28 11:10:55.055 31182-31182/com.sitewalk.typeanumber I/System.out﹕ Sending WAIT chunk
01-28 11:10:55.055 31182-31182/com.sitewalk.typeanumber W/ActivityThread﹕ Application com.sitewalk.typeanumber is waiting for the debugger on port 8100...
01-28 11:10:55.775 31182-31188/com.sitewalk.typeanumber I/dalvikvm﹕ Debugger is active
01-28 11:10:55.865 31182-31182/com.sitewalk.typeanumber I/System.out﹕ Debugger has connected
01-28 11:10:55.865 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:56.075 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:56.275 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:56.475 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:56.675 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:56.875 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:57.075 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:57.275 31182-31182/com.sitewalk.typeanumber I/System.out﹕ waiting for debugger to settle...
01-28 11:10:57.475 31182-31182/com.sitewalk.typeanumber I/System.out﹕ debugger has settled (1340)
01-28 11:10:57.755 31182-31182/com.sitewalk.typeanumber W/PopupManager﹕ You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
01-28 11:10:57.835 31182-31182/com.sitewalk.typeanumber I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
OpenGL ES Shader Compiler Version: E031.24.00.07
Build Date: 04/07/14 Mon
Local Branch: au011
Remote Branch:
Local Patches:
Reconstruct Branch:
01-28 11:10:57.865 31182-31182/com.sitewalk.typeanumber D/OpenGLRenderer﹕ Enabling debug mode 0
01-28 11:11:01.435 31182-31182/com.sitewalk.typeanumber I/Choreographer﹕ Skipped 211 frames! The application may be doing too much work on its main thread.
01-28 11:11:01.665 31182-31182/com.sitewalk.typeanumber I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@42e3b748 time:437201118
01-28 11:11:10.835 31182-31182/com.sitewalk.typeanumber I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@42e3b748 time:437210285
Only one event log I have is:
11:10:34 Gradle build finished in 5 sec
Does anyone see my mistake?