I\'m trying to integrate twitter to my app, but I can\'t seem to get it to work.
This is my code:
public class OAuthForTwitter extends Activity {
I have solved this. Not exactly the way you have developed, but a slight different way. Here are the steps describing what i did.
Use webview instead of opening it in web browser: One of the key advantage doing it is , you can track the url redirects.
call setWebViewClient
method of your webview and override shouldOverrideUrlLoading
method of your class, i have used inner class.
You will have url parameter in your method. Check whether it starts with your own call back url or not, (Note: This url contains User Token and user secret that is necessary for authorization).
After you finish your task, you can hide the activity or remove the webView or any thing you desire.
EDIT : This is the oAuth way usually used in web application, so we don't need xAuth way. (In case other community members don't know)
Hope it will help you.
Your callback URL should be "sosInternational://HierBenIkNu" (instead of "sosInternational:///HierBenIkNu") in the Java code.
private final String CALLBACKURL = "sosInternational://HierBenIkNu";
Ok, it was quite a dumb mistake.
My <intent-filter>
wasn't inside an application..
This is how it is now:
<activity
android:name=".OAuthForTwitter"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleInstance">
<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="sosInternational" android:host="OAuthForTwitter"></data>
</intent-filter>
</activity>
This kind off works, it just loads the whole app from start.
Isn't there a way to just 'go back' to the last activity without restarting the whole app?