I have tried to integrate google play services into my app for several days now and I am completely frustrated. I could not integrate it to eclipse, so I decided to work with Android Studio from now on, so things there are new to me as well. I cannot get the samples from google to work (some dependency errors I guess because AS couldn't find R for example), so I tried to set up a new test project. But onConnectionFailed is called and I first get "Sign_In_Required" results and a window is prompted where I can tap my googleaccount and when I retry to start the app I get an "INTERNAL_ERROR" result or I am required to sign in again.
So what do I want from you? I want an idea what might went wrong and maybe some really good tutorials how to use google play services because the ones from google seem complicated (because they often do not seem to work if I try).
Androidmanifest:
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
games-ids.xml:
<resources>
<string name="app_id">(myappidnumber)</string>
<string name="package_name">(packagename)</string>
</resources>
build.gradle:
dependencies {
...
compile 'com.google.android.gms:play-services:8.4.0'
}
MainAcivity:
package (mypackage);
import android.content.IntentSender;
import android.os.Bundle;
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.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.drive.*;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
public class MainActivity extends FragmentActivity implements GoogleApiClient.ConnectionCallbacks, OnConnectionFailedListener{
private GoogleApiClient myClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this ,
this )
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
@Override
public void onStart(){
super.onStart();
myClient.connect();
}
@Override
public void onConnected(Bundle b) {
}
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.d("CODE1", "onConnectionFailed() called, result: " + result);
}
@Override
public void onConnectionSuspended(int result) {
}
}