2015-07-02 19 views
0

我有一個問題,當我嘗試在android中獲取谷歌令牌到Balidation後端。我創建Web應用程序客戶端ID(我用http://localhost在URL路徑),Android客戶端編號,並使用此代碼:驗證後端與Android上的獲得谷歌令牌

public class GoogleOAuthTask extends AsyncTask<Void, Void, String> { 

private static final String TAG = GoogleOAuthTask.class.getSimpleName(); 
Activity mActivity; 
String mEmail; 

private final static String SCOPE = "audience:server:client_id:XXXXXXXXXXXXXXXXXXXAAAAAXXXXXXXXXXX.apps.googleusercontent.com"; 

public GoogleOAuthTask(Activity activity, String email) { 
    this.mActivity = activity; 
    this.mEmail = name; 
} 

@Override 
protected String doInBackground(Void... params) { 
    String accountName = "[email protected]"; 
    Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE); 
    String scopes = "audience:server:client_id:XXXXXASASXXXXX.apps.googleusercontent.com"; // This is my Web Application Client Id 
    try { 
     return GoogleAuthUtil.getToken(mActivity, account, scopes); 
    } catch (IOException e) { 
     Log.e(TAG, "Error retrieving ID token.", e); 
     return null; 
    } catch (GoogleAuthException e) { 
     Log.e(TAG, "Error retrieving ID token.", e); 
     return null; 
    } 
} 
} 

我的問題是:

當我打電話GoogleAuthUtil.getToken(mActivity,帳戶,範圍)代碼不會繼續,即方法永遠不會結束。

我等着

更多信息:

我使用.android/debug.keystore產生SHA-1散列 我用http://localhost在JavaScript源 我重定向URI使用http://localhost/MyWebService。 這條線出現在logcat中:

Could not find method android.app.Notification$Builder.setLocalOnly 

回答

0

的問題是在的AsyncTask線程池。

相關問題