Is there any built-in way to initiate a login without using the TwitterLoginButton
. All examples that I could find use a TwitterLoginButton
.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This works.
TwitterAuthClient mTwitterAuthClient= new TwitterAuthClient();
mTwitterAuthClient.authorize(activity, new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> twitterSessionResult) {
// Success
}
@Override
public void failure(TwitterException e) {
e.printStackTrace();
}
});
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
mTwitterAuthClient.onActivityResult(requestCode, responseCode, intent);
}