Sharing an Application on a Social Network

A lot of gaming applications make it quite easy for the user/player to post their high scores to Twitter and Facebook. There are reasons for this that go beyond the user’s urge to brag, as this is a very effective marketing technique (see Figure 5-2).

images

Figure 5-2. At the end of Doodle Jump, the user/player has the option of sharing his or her score on Facebook. Is this feature for the user, the developer, or both?

By simply agreeing to post their high score on a social networking site, the user is letting all their Facebook friends and Twitter followers know that they have been playing a game, and that game is your application. As a result, word of mouth will spread about your application, and more people will download it.

Both Twitter and Facebook have sites devoted to developers that will help them program their applications for social networking. The one for Twitter is https://dev.twitter.com/ and the Facebook one is http://developers.facebook.com/.

Another simple way to create a link to Twitter or Facebook from within the application is to use the procedures that I instructed for getting a review. What you need to do is just alter the code for the line webView.loadUrl("Your application on the Android Market") to read webView.loadUrl("http://www.facebook.com") or webView.loadUrl("http://www.twitter.com").

You should change the Buttons’ android:id to something like btnFacebook and btnTwitter, and you should change the text to something like “Share on Facebook” and “Share on Twitter.” You could use words on the Buttons to do that, but I would highly suggest creating an ImageButton. An ImageButton allows the developer to create a bitmap image that the user can click to get a result.

An ImageButton is created like a Button is in the main.xml file. The difference is that you want to specify a source for the image that you are using. Here is some sample code that you can use and tamper with:

<ImageButton android:id="@+id/Facebookbtn"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:src="@drawable/facebook_logo">
</ImageButton>

In case you are wondering what is meant by facebook_logo, this is what I recommend for any Button that links to the social network. I mentioned in earlier chapters that images create more recognition than words. So if you want users to share about your application on Twitter and Facebook, then you had better make it easy for them by putting the logo of a social network right on the application.

In Chapter 12, I discuss how to upload an icon and background to your application. You can read the particulars about it there, but I will let you know that it is all about moving the image for your ImageButton into the res/drawable file. You should be able to find an image of the Facebook and Twitter logo online, and you will want to be certain that it is a good length and width before you upload it to the drawable file. You will want to make certain that the name of the image file is the same, like facebook_logo in this example.

There are other options for sharing on social networks as well. Figure 5-3 is a screenshot of a game called Ninjump, from Backflip Studios. Like most games, it prompts you to send your high score to Twitter, Facebook, and another option opens up quite a list.

images

Figure 5-3. What you will see at the end of Ninjump, when a high score is achieved.

If you click the envelope in Figure 5-3, it will open up a whole list of media that you can use to share your high score on Ninjump. On this list is Bluetooth, Doc, Email, Evernote, Facebook, Gmail, Goggles, Online Album, Photo Sharing, Picasa, Print to Retail, Text Messaging, Twitter, and Yahoo Mail. In all honesty, I don’t see a reason to have so many ways of sharing, but they are all there.

In the same manner, you can program your application so it will create a list of ways that make it easy for the user to share about your application. As long as you send items to an intent, it can handle any list of programs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.196.223