我有兩個應用程序使用同一個帳戶類型。我想頁面下方,當用戶打開了第一次,第二應用程序中顯示,一個帳戶存在:無法從不同的應用程序爲自定義帳戶獲取AuthToken
但是當我運行這段代碼什麼也沒有發生:
final AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(account, authTokenType, null, this, null, null);
new Thread(new Runnable() {
@Override
public void run() {
try {
Bundle bnd = future.getResult();
final String authtoken = bnd.getString(AccountManager.KEY_AUTHTOKEN);
showMessage((authtoken != null) ? "SUCCESS!\ntoken: " + authtoken : "FAIL");
Log.d("udinic", "GetToken Bundle is " + bnd);
} catch (Exception e) {
e.printStackTrace();
showMessage(e.getMessage());
}
}
}).start();
上面的代碼當我從具有驗證器的應用程序運行它時正常工作。當我運行下面的代碼時,系統生成一個通知,當我點擊它時,上面的圖片出現。
final AccountManagerFuture<Bundle> future = mAccountManager
.getAuthToken(account, authTokenType, null, true,
null, handler);
點擊允許按鈕會正確返回AuthToken
。但是,我想在撥打getAuthToken
時看到授權許可頁面(上圖),而不是點擊通知。我怎樣才能做到這一點?
AUTH_TOKEN_TYPE_FULL_ACCESS的值是什麼?它是「完全訪問」,在我的情況下,當應用程序安裝第一次然後屏幕上方顯示,但沒有發生任何事情後 –