This is a library to use Twitter functionality in b4a with oAuth authentication. The library is a little bigger than is allowed on this forum, but you can download it from
http://www.gorgeousapps.com/ABTwitter.zip
To use this library you need to do the following steps:
1. If you do not have one, make a twitter account
2. Go to Twitter to add your app to twitter
3. Fill in the fields on the website (See attachment Twitter1.jpg)
4. Note the consumer key and consumer secret (See attachemt Twitter2.jpg) You'll need them later in your code.
How does it work
By using the consumer key, consumer secret, a token and a token secret you can connect to a twitter account.
To get the token en token secret you can add the following snippet:
The user is directed to the twitter website to login.
After login in, the user receives a PIN code.
He can now enter this PIN code into your app, and then rerun the ABConnect function, but now with the ABtoken and ABtoken secret:
It is best to save the ABToken and ABtokenSecret on the device, so the user only has to do this once.
The next time the app is running, just read the saved Token and TokenSecret and run the following snippet (using your codes):
A litte demo app is attached to show you some basic tasks like getting your tweets and sending a tweet, but there are many more functionalities.
Do not forget to change the Consumer Key and Consumer Secret if you create a new app!
http://www.gorgeousapps.com/ABTwitter.zip
To use this library you need to do the following steps:
1. If you do not have one, make a twitter account
2. Go to Twitter to add your app to twitter
3. Fill in the fields on the website (See attachment Twitter1.jpg)
4. Note the consumer key and consumer secret (See attachemt Twitter2.jpg) You'll need them later in your code.
How does it work
By using the consumer key, consumer secret, a token and a token secret you can connect to a twitter account.
To get the token en token secret you can add the following snippet:
B4X:
' replace the codes by your consumer key an consumer secret generated on the twitter page
Dim Ret as Boolean
Ret = myABTwitter.ABConnect("DfNWSCNc1TaTpcsDcMPK", "Y0gYdZFdX78HmoybH1fLRkX6rbySxdxm8iRqpv14A", "", "")
If myABTwitter.ABURL <> "" Then
Dim p As PhoneIntents
StartActivity(p.OpenBrowser(myABTwitter.ABURL))
End If
The user is directed to the twitter website to login.
After login in, the user receives a PIN code.
He can now enter this PIN code into your app, and then rerun the ABConnect function, but now with the ABtoken and ABtoken secret:
B4X:
myABTwitter.ABEnterPIN(editText1.Text)
Ret = myABTwitter.ABConnect("DfNWSCNc1TaTpcsDcMPK", "Y0gYdZFdX78HmoybH1fLRkX6rbySxdxm8iRqpv14A", myABTwitter.ABToken , myABTwitter.ABTokenSecret)
It is best to save the ABToken and ABtokenSecret on the device, so the user only has to do this once.
The next time the app is running, just read the saved Token and TokenSecret and run the following snippet (using your codes):
B4X:
Ret = myABTwitter.ABConnect("DfNWSCNc1TaTpcsDcMPK", "Y0gYdZFdX78HmoybH1fLRkX6rbySxdxm8iRqpv14A", Token, TokenSecret)
A litte demo app is attached to show you some basic tasks like getting your tweets and sending a tweet, but there are many more functionalities.
Do not forget to change the Consumer Key and Consumer Secret if you create a new app!