2012-07-18 48 views
0

我使用下面的代碼正確調用。回調沒有得到在Twitter的整合

<activity android:name=".PrepareRequestTokenActivity" android:launchMode="singleTask"> 
    <intent-filter> 
     <action android:name="android.intent.action.VIEW" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
     <category android:name="android.intent.category.BROWSABLE" /> 
     <data android:scheme="http" android:host="m.devbee.com" /> 
    </intent-filter> 
</activity> 

我的Twitter的應用程序回調URL是Callback URL http://m.devbee.com

現在問題後,該功能被稱爲

@Override 
    protected Void doInBackground(Void... params) { 

     try { 
      Log.i(TAG, "Retrieving request token from Google servers"); 
      final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL); 
      Log.i(TAG, "Popping a browser with the authorize URL : " + url); 
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND); 
      context.startActivity(intent); 
     } catch (Exception e) { 
      Log.e(TAG, "Error during OAUth retrieve request token", e); 
     } 

     return null; 
    } 

我點擊我的瀏覽器「授權應用程序」按鈕,而不是將其調用我PrepareRequestTokenActivity活動,它提供了錯誤說

Web Page Not avaliable. 

爲什麼這個活動沒有被調用。 Url都是一樣的。

回答

0

當你請求的OAuth的認證流程(request_tokens法)臨時令牌,它不會在HTTP請求返回的網頁,但寫的GET(或POST)某些參數的參數。請參見相應的文檔瞭解更多信息:https://dev.twitter.com/docs/api/1/post/oauth/request_token。此外,你跟隨Twitter的說明正確authnticate你的要求(https://dev.twitter.com/docs/auth/authorizing-request)?

+0

實際上這是什麼回調URL。當打開這個url時,browswer會自動觸發PrepareRequestTokenActivity。我的問題是。爲什麼沒有觸發它。 – 2012-07-18 17:45:36