App Inventor and the Twitter Component


A quick Twitter Tutorial with App Inventor 2

Let's tweet with App Inventor 2! Now in App Inventor 2 we also can tweet with images! The App Inventor team did a great job, everything is so easy to do, and I know what I'm talking about, see my Twitter example using the web component, where I did everything by hand, which was a nightmare.

Note: There is no TwitPic API key required anymore!

Preparation: Get a Twitter Consumer key and Consumer secret.

You already have a Twitter account. Now follow the documentation to get a Consumer key and Consumer secret.





Login

As mentioned in the documentation, App Inventor does all the "ugly" work for you: Login is handled using the OAuth protocol, as required by the Twitter API ( dev.twitter.com/pages/auth ). An App Inventor app that needs to make Twitter API calls on behalf of an authenticated user should first call Authorize. This loads a Twitter login page that will allow the user to login with their username and password, and then return appropriate credentials to the Twitter component in the app. Once the Twitter component has the credentials the IsAuthorized event is raised to let the app know that it can proceed with Twitter API calls.

Tweet

This snippet shows how to tweet with or without image.

Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.

Timeline

Followers

Mentions

Follow

Other Blocks used

Test

Tested successfully on Samsung Galaxy Tab 10.1N running Android 3.2.
Note: the Twitter component requires min. Android version 2.3.

Questions and Answers

Q1: I'm wondering about what happens after the user authenticates their Twitter Account in an AI2 app, are they good to go? Is there the need to log in to Twitter over and over again when you close the AI2 App, then reopen the app at another time and access it's Twitter screen?
A: The user only needs to login once. He/she only needs to re-atuthenticate after the user revoked access to your app, see also the Twitter support page.

Download


If you find this example helpful and you are using it in one of your projects,
be nice and donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

Download aia file for App Inventor
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact