简体   繁体   English

Twitter4j回拨问题 - 在浏览器中打开回调活动

[英]Twitter4j Call back issue - opening callback activity in browser

I am integrating twitter posting in my app using twitter4j library. 我正在使用twitter4j库在我的应用程序中集成twitter发布。 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. 无论哪种方式,请帮我解决这个问题。

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. 它在浏览器本身内打开自定义URL链接,因为您尚未定义哪个活动应该处理自定义链接或您尚未定义正确的类别。 Here is a sample. 这是一个例子。 Make sure you include the categories. 确保包含类别。 The android.intent.category.BROWSABLE will ensure that the browser opens your app. android.intent.category.BROWSABLE将确保浏览器打开您的应用程序。

    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>

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. 您已经安装了具有相同回调的应用程序,您必须从清单更改回调字符串并从activity.try回调常量以使用唯一的回调地址。

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

and

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM