i am developing an application for android and would like for my users to be able to post some information from my application to their twitter feed. i know how to make this work by building a VIEW intent and forwarding the user to the android built-in web browser (thanks to stack overflow!) However, now that there is an official Twitter application, I would like to be able to use the twitter applications activity (if it is installed) to make the post. However, I can not find any developer documentation on what the Twitter Intent for Android is called. Can someone provide a short snippet of sample code that includes that text of the Intent to use?
A:
Well, actually... the best thing you can do is using the twitter4j api: http://twitter4j.org/en/index.html
That way you can easly build a custom, simple client for twitter that will make your users feel more confortable. And your app wont depend on the official twitter client which probably is not installed in some handsets.
Cristian
2010-05-25 00:06:20
as I mentioned, I already have support for Twitter in the application by using an ACTION_VIEW and forwarding the user to the browser. It works nicely, the user is asked to auth and if they've already authenticated, then they are just taken to their post page. What I was trying to do was make the experience slightly nicer for those people that opted to download the official Twitter application, but routing my activity requests to that app if it existed.
sorens
2010-05-25 00:14:24
+3
A:
Can someone provide a short snippet of sample code that includes that text of the Intent to use?
The official Twitter app may support the ACTION_SEND
Intent
, like Twidroid does. If so, this blog post describes the basic techinque (forgive any formatting issues).
CommonsWare
2010-05-25 00:07:40
thanks for the suggestion. I had already tried using an ACTION_SEND with a Intent.createChooser() but it just goes to the gmail application and doesn't pop-up a choice for twitter.
sorens
2010-05-25 00:12:12
Well, that's just sad. Googlers even wrote this app -- I expected better. Regardless, if they don't support `ACTION_SEND`, then I doubt there is any other supported way to send a tweet through them. We'll know more when the app is released as open source, which I am hoping will occur within a few weeks.
CommonsWare
2010-05-25 00:53:30
btw, to clarify, i had a typo-bug in my code (I was using `plain/text` instead of `text/plain` for the intent type) and obviously Android didn't know what to do with me. SO, word to the wise, make sure you are using `text/plain` for your intent type and `ACTION_SEND`. thanks again for the help.
sorens
2010-07-20 19:43:44