Google Details The Power Of Share Intent
Earlier today, Oovoo revealed their new app that essentially adds Google+-style Hangouts to Facebook. Google already fired a preemptive shot without even knowing it with Android’s share intent feature. It allows users to share content with others directly from an app. They are now taking that to the Web at large.
With the recent launch of the ShareCompat library, Google is bringing Open Graph-like functionality to the Web at large. Whereas Facebook’s system only allows apps to connect and share with Facebook, Google’s ShareCompat lets apps share with the entire Internet. Google is of course going to use their own service, Google+, to show off the new features, but it will work with anything, including Facebook.
First up is creating the Share Intent. It’s a simple piece of code that lets application know what to share and what to share said content to. In this case, the location is Google Plus and the content is a simple bit of text using the setText method. You will also have to use the setType method to let it know that you’re only sharing plain text.
Sharing text is super easy, so what about sharing videos and pictures? They will be more prominently shared across apps to social networking services. In that case, it just takes a few small modifications to the code to get it working. The first is that you’ll want to change setType to media like “image/png” or “video/mp4” instead of plain text. Secondly, you’ll want to tell the intent builder that you’re sending the media URI of the picture that is being shared.
Once you combine all of these into one share intent, the resulting product should look a little like this:
The one downside to share intent is that it’s only available on Android. It’s unfortunate then that Google’s “Open Graph” of the Web is restricted to their platform. If you are an Android developer and want to take advantage of it, you can hit up the documentation here. It should set you on the right footing to start making Android apps that share stories with the Internet at large.