I am trying to write twitter app using android. The twitter login page opens and after login, it tries to open the callback url and says cannot open URL. Please help me to know how to get the control back in my app so that onNewIntent method is called.
I tried the solutions mentioned in many posts like providing the intent filter in manifest file, implementing onResume, still no use.
Here is the manifest file:
<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>
...
The java code
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) {
}
Thanks in advance.
i think call back url such like this :
OAuthTwitter://myTweet