Request OAuth (when twitter button cliked)
final String TW_CALLBACK_URL_STRING = "http://test.com/callback";
final Uri TW_CALLBACK_URI = Uri.parse(TW_CALLBACK_URL_STRING);
twitter4j.auth.RequestToken twRequestToken =
twitter.getOAuthRequestToken(TW_CALLBACK_URI.toString());
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(twRequestToken.getAuthorizationURL()));
activity.startActivityForResult(intent, TWITTER_REQUEST_CODE);
Manifest
<activity android:name=".TwitterLinkActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data
android:scheme="http"
android:host="test.com" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Twitter Developer App Settings
Clicking twitter button on my app, Web Browser (chrome android) is opened.
And I log in twitter account and click "accept app" button ("애플리케이션 승인" in below image, UZTest is my test twitter app name.) I am not native English speaker. So I do not know exactly words in English...
I think browser link to http://test.com/callback?~~~~. And My app catch this url, and start activity.
But my app can not... It just link http://www.test.com in chrome android browser.
I tried change callback url = "myapp://test.com", but only http(or https) is only available. (Twitter Developer)
How can I receive oauth token?