gpt4 book ai didi

android twitter4j 回调调用主要 Activity

转载 作者:行者123 更新时间:2023-11-30 04:27:33 26 4
gpt4 key购买 nike

Twitter 回调将我返回到主 Activity 而不是 TwitterActivity,这是我的代码。有什么建议吗?

这是我的 list :

<activity android:name=".TwitterActivity" 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:scheme="twitter-callback" />
</intent-filter>
</activity>

这是我的代码:

private static final String CALLBACK_URL = "twitter-callback:///";
// Some code
private void dealWithTwitterResponse(Intent intent) {
Uri uri = intent.getData();
if (uri != null && uri.toString().startsWith(CALLBACK_URL)) { // If the user has just logged in
String oauthVerifier = uri.getQueryParameter("oauth_verifier");

authoriseNewUser(oauthVerifier);
}
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.i(TAG, "New Intent Arrived");
dealWithTwitterResponse(intent);
}

@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "Arrived at onResume");
}

最佳答案

你可以试试这个回调地址。

  public static final String    OAUTH_CALLBACK_SCHEME   = "x-oauthflow-twitter";
public static final String OAUTH_CALLBACK_HOST = "callback";
public static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;

关于android twitter4j 回调调用主要 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8212356/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com