2010-12-12 8 views
3

ねえ。私はTwitter4j APIを使ってアプリケーションを開発しています。アプリケーションを許可してアクセストークンを取得するために、マニフェストファイルで設定したコールバックパラメータでブラウザを起動します。Twitterでアプリを許可した後にOauthコールバックが見つかりません

<data android:scheme="scheme" android:host="authenticatorapp"></data> 

アプリケーションを許可した後、ブラウザは次の呼び出しを行い、見つからないメッセージで失敗します。 scheme:// authenticatorapp?oauth_token = n5vd99dfnmnf ...

エミュレータとデバイスの両方で試しました。

12-12:15:04:05.743:ERROR /ブラウザ(230):エミュレータで 、LogCatは私にこれを与えonReceivedError -10スキーム://?authenticatorapp oauth_token = JJ ... M & oauth_verifier = 3ZfuY ...プロトコルはサポートされていません。

- マニフェストファイル:

<activity android:name=".AuthenticatorApp" 
     android:launchMode="singleInstance" 
     > 
     <intent-filter>   
      <category android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
      <data android:scheme="scheme" android:host="authenticatorapp"></data>         
     </intent-filter>    
    </activity> 

    <!-- Broadcast Receiver that will process AppWidget updates --> 
    <receiver android:name=".ZaytungWidget" android:label="@string/widget_name"> 
     <intent-filter> 
      <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />        
     </intent-filter> 
     <meta-data android:name="android.appwidget.provider" 
      android:resource="@xml/tweet_metadata" /> 
    </receiver> 
    <!-- Service to perform web API queries --> 
    <service android:name=".ZaytungWidget$UpdateService" /> 
</application> 

<uses-sdk android:minSdkVersion="4" /> 
    <uses-permission android:name="android.permission.WRITE_SETTINGS" /> 
    <uses-permission android:name="android.permission.INTERNET" />  

答えて

3

マニフェストファイル全体を投稿できますか? OAuth instance state in Android

役立つかもしれない次の例のアプリケーションにリンクされている質問は、::

http://code.google.com/p/jpoco/source/browse/trunk/jpoco-android-app/AndroidManifest.xml

+0

ありがとう、私はマニフェストファイルを追加しました、私はウィジェットからこれを開始しようとしているので、私は例えばメインアクションが必要であるかどうか確信できませんでした。 –

+0

うわー、それは働いた。ありがとう!

+0

@オクルン:面白い解決法:私は正しく理解しているかどうかを確認するための質問があります。ネイティブアプリを持っていて、ユーザーがTwitterのOAuthピンを入力する必要がないようにコールバックを取得するのは正しいのですか?あなたのアプリをtwitterで登録したとき、それを 'Desktop app'または 'Web app'として設定しましたか? –

0

あなたはネイティブアプリを開発している場合、あなたはコールバックパラメータを使用しますが、できるようにする必要はありません。ユーザーはアプリのどこかにピンを入力します。これは、ブラウザでauthorization_urlを開いたとき、またはおそらくウェブビューでアプリ内で快適に開くことができます。

また、ユーザーが認可ツイッターのWebページで「はい」をクリックした後、自動的にピンを取得することもできますが、ツイッターToSに該当するかどうかはわかりません。

+0

ありがとうございました。 –

1

これは私が持っているものである

は、私は、後に有用である可能性がある、次の質問を見つけました私の作業Manifest.xmlです。ここで、org.gpsagenda.OAUTHはAuthenticatingを行っているアクティビティです。

 <activity android:name="org.gpsagenda.OAUTH" > 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW"></action> 
      <category android:name="android.intent.category.DEFAULT"></category> 
      <category android:name="android.intent.category.BROWSABLE"></category> 
      <data android:scheme="gpsagenda" android:host="twitt" /> 
     </intent-filter> 
    </activity>