SubscribeSubscribe with Androidlift to get new post on mail.

Android Facebook Sharing Links, Images, Videos with like button

Android Facebook Sharing 

Android Facebook Sharing details how to enable sharing from your Android app to Facebook. When someone shares from your app, their content appears on their Timeline and may appear in their friends’ News Feeds.

  • Get a Facebook App ID properly configured and linked to your Android app. See Android Facebook Login post and follow its first step.
  • Add Facebook Activity – Include this in AndroidManifest.xml
  • Set up a ContentProvider in your AndroidManifest.xml where {APP_ID} is your app ID:

Modeling Content

Versions 4.0+ of the Facebook SDKs have new models for sharing content. Each type of content people want to share has a class you can use to represent it. After you model the content, add a sharing interface to your app.

Like Button

The Like button is a quick way for people to share content with their friends. A tap on the Like button will ‘like’ pieces of content from your app and share them on Facebook. The Like button can be used to like a Facebook Page or any Open Graph object and can be referenced by URL or ID. To add a Like button add the following code snippet to your view:


When people share links from your app to Facebook, it includes attributes that show up in the post:

  • a contentURL, the link to be shared
  • a contentTitle that represents the title of the content in the link
  • a imageURL, the URL of thumbnail image that will appear on the post
  • a contentDescription of the content, usually 2-4 sentences
  • Build your share content for links into the ShareLinkContent model.

Photos

People can share photos from your app to Facebook with the Share Dialog or with a custom interface.

  • The photos must be less than 12MB in size
  • People need the native Facebook for Android app installed, version 7.0 or higher
  • Build your share content for photos into the SharePhotoContent model.

Videos

People using your app can share videos to Facebook with the Share dialog or with your own custom interface.

  • Videos must be less than 12MB in size.
  • Build your share content for videos into the ShareVideoContent model.

Complete Source Code for Android Facebook Sharing:

Download From Githubdownload code from github

That sit, Now just run the Android Facebook Sharing project and share the content on Facebook via your own android Android Facebook Sharing app.

Best Luck…!

 

 

(12)