Twitter4j Call back issue - opening callback activity in browser

734 Views Asked by At

I am integrating twitter posting in my app using twitter4j library. I am following this. But I am having issue in call back. After authorizing it doesn't actually comes to our app, but actually it opens up call back activity that we specified in browser. I am not sure why this is happening.

I tried to search but couldn't find anything related to this. So May be people haven't noticed or I missed something while integrating it.

Either way please help me to resolve this issue.

2

There are 2 best solutions below

6
On

you already install app with same callback, you must change the callback String from manifest and call back constant from activity.try to use unique call back Address.

<data android:scheme="login-twitter" android:host="callback1" />

and

 static final String TWITTER_CALLBACK_URL = "login-twitter://callback1";
0
On

It's opening the custom URL link inside the browser itself because you haven't defined which activity should handle the custom links Or You haven't defined proper categories. Here is a sample. Make sure you include the categories. The android.intent.category.BROWSABLE will ensure that the browser opens your app.

    private final String CALLBACKURL = "x-oauthflow-twitter://privlyT4JCallback";

    <activity
        android:name=".TwitterLinkGrabberService"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:launchMode="singleInstance" >
        <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="privlyT4JCallback"
                android:scheme="x-oauthflow-twitter" />
        </intent-filter>
    </activity>