There are two general ways you can go with twitter integration.
1) If you want to implement only posting, and you do not need to know if a user posted a message or cancelled the posting sequence
In this case you can use native platform API.
- You do not need to create your Twitter app
- You do not need to prompt user to authenticate with your app with requested permissions before you can use Twitter API
- User will not leave your app for Twitter authentication.
- Posting looks natively to platform
- You can only prompt user to post messages / images to twitter.
- You will not know or be able to respond if the user cancels their post from the twitter app.
If you decide to go this way, you may use the following API calls from anywhere in your project to prompt the user to tweet a message or image, using Twitter's UI:
SPShareUtility.TwitterShare("This is my text to share"); SPShareUtility.TwitterShare("This is my text to share", ImageToShare);
Result of this API calls would be similar to screenshot below:
You may read more about native shared behavior on different platforms at this section.
2) If you need a lot more, and you want to use all plugin power.
- You will be able use all feature offered by the plugin
- More permissions from the user
- Full control of user actions
- You have to create app on twitter.
- Extra work with rendering message windows, since we are calling API directly
If you decide to go this way. Then you need to complete Setup Steps before you begin to use Twitter API.
I would recommend creating singleton class which will be responsible for all your game twitter interactions.