kullanma Google Play Hizmetler:
http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html
sizin kapsamına https://www.googleapis.com/auth/userinfo.profile ekleyin.
Örnek:
String scope="oauth2:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
final String token = GoogleAuthUtil.getToken(context, "[email protected]", scope);
VEYA "kaba kuvvet" Artık
Intent res = new Intent();
res.addCategory("account:[email protected]");
res.addCategory("scope:oauth2:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile");
res.putExtra("service", "oauth2:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile");
Bundle extra= new Bundle();
extra.putString("androidPackageName","com.your.package");
res.putExtra("callerExtras",extra);
res.putExtra("androidPackageName","com.your.package");
res.putExtra("authAccount","[email protected]");
String mPackage = "com.google.android.gms";
String mClass = "com.google.android.gms.auth.TokenActivity";
res.setComponent(new ComponentName(mPackage,mClass));
startActivityForResult(res,100);
, buradan https://accounts.google.com/IssuedAuthSubTokens erişimini iptal zaman uygulama cihazında tekrar size izin penceresini gösterir.
sonunda yararlı bir not google izinleri vermek için tekrar sordum başlamıştı yapmak: Eğer Sqlite3 cihazda zaten değilse, sistem klasörü yazılabilir yapmak gerekir ve belki adb ile zorlamak gerekir. http://stackoverflow.com/questions/6066030/read-only-file-system-on-android –
Başka bir ipucu: "sqlite" ı tırnak ile çağırmam gerekiyordu, aksi halde bir hata aldım. Bkz. Http://stackoverflow.com/questions/13696259/sqlite3-on-android-fails-with-syntax-error-unexpected/13697187#13697187 –
Bu problemde hala yolun aşağısında bulunanlar için ilgi: (1) Çok kullanıcılı destek ekleyen Android 4.2'de, account.db dosyası kullanıcı başına bir alt dizine yerleştirilir. /data/system/users/0/accounts.db (2) Bu izinleri iptal etme ihtiyacım olduğunda, /data/system/users/0/accounts.db adresindeki hibe tablosunun boş olduğunu tespit ettim. Jeton almak için yeni Google Play Hizmetleri libresini kullanıyordum ve bu, hibeleri başka bir yerde (muhtemelen bulutta bile!) Saklıyor gibi görünüyordu. – Hugh