こんにちは、Twitter で auto を使用しています。
アクセスを「読み取り専用」から「読み取りと書き込み」に変更するまで、私のコードはうまく機能していました。
私の問題は、Web ページで [サインイン] をクリックした後、アプリに戻らないことです。
私はそれについて読みましたが、それがコールバック URL に関するものであることを知っています。
これが私のコードです:
static final String TWITTER_CALLBACK_URL = "oauth://t4jsample";
private void loginToTwitter()
{
// Check if already logged in
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
Configuration configuration = builder.build();
TwitterFactory factory = new TwitterFactory(configuration);
twitter = factory.getInstance();
try {
requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));
} catch (TwitterException e) {
Toast.makeText(OpeningPage.this, "Something went wrong, please try again", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
私のマニフェスト:
<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:host="t4jsample"
android:scheme="oauth" />
</intent-filter>
私のツイッター設定ページ:
助けてくれてありがとう