Android Content Sharing¶
To take advantage of this new feature in Flurry analytics, you’ll need to download the latest Flurry SDK for Android. The feature is enabled starting wiht the iOS SDK version 6.0. Once you download the new SDK, make sure that you replace any existing Flurry library folders from your project’s file folder with the latest files before proceeding.
Follow the steps described in this guide.
The sample app that implements Tumblr in-app sharing, is avalable from the gitHub. The accompanying blog post is available.
Log in to the Flurry Dashboard and Enable Content Sharing¶
To post content to Tumblr, you’ll need to enable your app for Content Sharing.
- Navigate to YourApplication > Manage
- Select App Info.
- In the Application Info panel, click Enable content sharing.
Set the Consumer API Key and Secret¶
Use the following method to set the consumer API key and secret:
import com.flurry.android.tumblr.TumblrShare; String apiKey = “CONSUMER_API_KEY”; String secret = “CONSUMER_API_SECRET”; TumblrShare.setOAuthConfig(apiKey, secret);
You’ll need to generate Tumblr oAuth keys at https://www.tumblr.com/oauth/apps. You’ll need these keys for users to be able to authenticate your app to post to Tumblr.
Create and Send a Post¶
Follow these steps for sending photo and text posts.
A Photo Post Example¶
This example illustrates a photo post without a caption. You can add a caption if you want.
Note the following:
- The Url for the photo cannot be null.
- The Url can only be a valid file or http(s) url.
- The PhotoPost url is mandatory. Note that in order to provide a good user experience, it is strongly advised to provide deeplinks and a web link to the photo content.
- If you’re posting a valid file to Tumblr, include the
android.permission.READ_EXTERNAL_STORAGEpermission in your manifest file.
- Deeplinking enables you to click a button that shares the content. A Deeplink is the URL that will be called when a user clicks the shared content in the Tumblr app.
A Text Post Example¶
This example illustrates a text post with a title and body.
Note the following:
- A Post body cannot be null or empty.
- For a text post, only the body is mandatory. All other fields are optional. Note that in order to provide good user experience, it is strongly advised to provide deeplinks and web link. Listen to the PostListener events to handle the success and failure cases appropriately.
onPostSuccess. Fired when post is successfully created. It also returns the postId created by Tumblr.
onPostFailure. This listener method is fired when a post fails due to any reason. This listener is fired with a user-friendly errorMessage explaining the reason for the failure.
Was this document helpful?