Я пытаюсь написать приложение для Твиттера с помощью Android. Откроется страница входа в систему в твиттере, и после входа в систему он пытается открыть URL-адрес обратного вызова и говорит, что не может открыть URL. Пожалуйста, помогите мне узнать, как вернуть элемент управления в мое приложение, чтобы вызывался метод onNewIntent.
Я попробовал решения, упомянутые во многих постах, такие как предоставление фильтра намерений в файле манифеста, реализация onResume, но до сих пор бесполезный.
Вот файл манифеста:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyTwitter"
android:label="@string/app_name">
<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" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="OAuthTwitter" android:host="myTweet" />
</intent-filter>
...
Java-код
final public static String CALLBACK_URL = "myTweet-OAuthTwitter:///";
commonHttpOAuthConsumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
authProvider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token", "http://twitter.com/oauth/access_token", "http://twitter.com/oauth/authorize");
try {
String oAuthURL = authProvider.retrieveRequestToken(commonHttpOAuthConsumer, CALLBACK_URL);
this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(oAuthURL)));
}
catch (OAuthMessageSignerException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
catch (OAuthNotAuthorizedException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
catch (OAuthExpectationFailedException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
catch (OAuthCommunicationException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
protected void onNewIntent(Intent intent) {
}
Заранее спасибо.