Share Android Apps on Twitter (or anywhere else)
I attended the Mobile Monday meeting "200,000 Apps - Where's Mine" last night. One thing that became clear is that apps don't do a very good job of promoting themselves. One crippling problems with most app stores is that there's no (easy) way to share an app with a friend.
Here's some basic code for an Android app which will post the URL of your app to Twitter. Stick it in a button or menu item for easy sharing.
String twitterUri = "http://m.twitter.com/?status=";
String marketUri = Uri.encode("http://example.com/?q=app&title=test");
Intent shareOnTwitterIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(twitterUri + marketUri));
startActivity(shareOnTwitterIntent);
Some important things to note.
- This is set to post to the mobile version of Twitter. Your user is on a phone - don't direct them to a site that won't work on their device.
- The second string is URI encoded.
- Consider if you want to post a "market://" link. I would advise against it. Twitter won't render it as a link and, even if it did, 90% of users won't be able to click on it. Make it a link that will direct desktop users to your website, mobile users to a mobile friendly site and Android users direct to the market.
Facebook also has an API for this sort of sharing.
http://m.facebook.com/sharer.php?u=example.com&t=test
Again, it points to the mobile site and needs to be URL encoded.
Happy sharing!
James Hugman says:
Hi Terence,
I'd like to offer a refinement.
Rather than directing users to open a browser that opens up a mobile site, ask them how they'd like to share, and then launch the app that they usually use:
This chooser will offer a list of apps that are able to share text and are installed, including email.
Terence Eden says:
Brilliant idea. Although it will require the user to have a Facebook or Twitter app installed.
Yahel Bouaziz says:
Hi both,
I went with James idea, works perfectly.
Thank you guys, real time saver !!