Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

android twitter4j authentication via installed twitter app not browser

i am using twitter4j in my android application to post status to twitter like in this example: http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/

All is working good but the question is: The authentication is done via browser .. is there any way to detect if twitter app already installed on mobile and authenticate via it ?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

EDITED: November 27, 2014

Twitter recently released Fabric that does include SSO support. From the Android docs:

When attempting to obtain an authentication token, the Kit will use the locally installed Twitter app to offer a single sign-on experience. If the Kit is unable to access the authentication token through the Twitter app, it falls back to using a web view to finish the OAuth process.

My older response is below.


tl;dr Currently, SSO with Twitter is not possible on Android.

Longer version: What you are basically asking for is Single sign-on (SSO), similar to what is available with the Facebook SDK for Android. Twitter has never bothered to even implement their own library for Android, let alone SSO. There are a bunch of people who have asked on the dev forums (here and here) but the standard response is, and I quote,

We do not currently offer a SDK for Android with the same level of tight integration as is available in iOS5.

Twitter needs to first get their Android app to support SSO. I would suggest using Facebook and Google+ for login instead of Twitter.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...