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.

  1. 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.
  2. The second string is URI encoded.
  3. 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!


Share this post on…

3 thoughts on “Share Android Apps on Twitter (or anywhere else)”

  1. 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:

    String marketUri = "http://example.com/?q=app&title=test";

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");

    intent.putExtra(Intent.EXTRA_SUBJECT, "I found an awesome app");
    intent.putExtra(Intent.EXTRA_TEXT, "Check this app out: " + marketUri);
    Intent chooser = Intent.createChooser(intent, "Which app you want to share with");
    startActivity(chooser);

    This chooser will offer a list of apps that are able to share text and are installed, including email.

    Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre> <p> <br> <img src="" alt="" title="" srcset="">