You may have seen the Twitter sample in Sample Folder 7: it shows how to use the Twitter control to add some basic Twitter functionality into your app.
You can add more functionality by controlling the Twitter app from your AppStudio program. To do this, you’ll need to have the Twitter app installed and be logged into it. Most Twitter users will not have to do anything extra.
Here’s what the sample app look like:
The method we’ll use to control Twitter is its URL Scheme. This isn’t documented officially that we could find, but it seems to work well.
Here’s the code for the Timeline button: it opens the Twitter app in its Timeline view:
Function Button1_onclick() location = "twitter://timeline" End Function
Substitute the name of the profile you want for “appstudiomobile”.
location = "twitter://user?screen_name=appstudiomobile"
Displays the standard Notifications screen. This one seems to work on iOS, but not Android.
location = "twitter://mentions"
Brings up a list of suggested users to tweet. Select one, then type the message you want.
location = "twitter://messages"
Opens the Twitter app with the message you enter. Click on Tweet to send it.
s = "twitter://post?message=" & encodeURIComponent(txtMessage.text) location = s
Here’s the complete undocumented list of Twitter URL codes:
twitter://list?screen_name=lorenb&slug=abcd twitter://mentions 'iOS twitter://messages 'iOS or Android twitter://post?message=hello%20world 'Android or iOS twitter://post?message=hello%20world&in_reply_to_status_id=12345 twitter://search?query=%23hashtag twitter://status?id=12345 'status of a message. iOS only. twitter://timeline 'iOS or Android twitter://user?id=12345 'iOS or Android twitter://user?screen_name=appstudiomobile
We haven’t found a way to send a photo using this API. For that, you will probably need to use this more complex method: