Share a URL on Facebook from Android App or Website


We recently developed an Android app for Activation Program for one of the prime Telecom Operator in India. There was a contest that winner will be decided on the basis of the maximum likes on Facebook for the GIF image created from Android App.

How to use share Dialog have been defined here –

Though after following above guidelines we faced multiple challenges in our app/website and will like to share those learning.

Learning 1 – GIF Upload

We expected GIF upload on facebook to behave similarly as JPEG Image upload but Facebook does not allow GIF to be uploaded from API. We have to upload GIF to cloud server and then share that URL as a post.

Learning 2 – Pre fill Message

This was the first time we were using Facebook Share for an Field Marketing Campaign where client wanted to Track all posts using HashTags, @ and wanted all user to share similar message.

  • You can not prefill the user message parameter with any content the user didn’t enter themselves, even if they can edit or delete that content before sharing. This applies to posts, comments, photo captions, and photo album captions.
  • You can not add your own content to that which the user manually entered. This includes hashtags, hyperlinks or URLs.
  • You can use custom composer where user can write a message in and that can be auto published to Facebook. But remember that user has to write content themselves and you can not prefill message in your App as well, else your Facebook App will get blocked.

Learning 3 – Custom Composer and App Review
If you are creating custom composer in your app then you need to get approval from facebook to get publish_action permission from user and you need to submit your app for review.

  • Review Process
    • You need to upload your app or give playstore link for facebook to review.
    • If app is not on playstore then you need to upload screencast showing the complete flow of application. Facebook reviews that you are not auto populating the content and once approved you can take user permission to allow post automatically.
    • Facebook take around 3-5 working days to review your app so if you are planning to use it for an event then plan accordingly as response from Facebook is very slow.

Learning 4 – Usage of Publish_Action permission

  • Provides access to publish Posts, Open Graph actions, achievements, scores and other activity on behalf of a person using your app.
  • Because this permission lets you publish on behalf of a user please read the Platform Policies to ensure you understand how to properly use this permission.
  • Your app does not need to request the publish_actions permission in order to use the Feed Dialog, the Requests Dialog or the Send Dialog
    Facebook JS SDK does not provide Post Id if we use share dialog without publish_actions so use feed dialog if you need Post Id.

Common Usage Allowed

  • Let people explicitly publish content from your app to Facebook from within a custom composer.
  • Seamlessly publish Open Graph stories for people when the user is aware and has appropriate controls.

Common Usage Restricted

  • Automatically publish stories without the person being aware or having control.
  • Publishing via dialogs or social plugins does not require this permission. Do not request review of this permission if you’re only using Share dialog, Feed Dialog, Message Dialog etc, or Social Plugins (e.g. the Like Button.)
  • Prefill the user message parameter of posts with content a person didn’t create, even if the person can edit or remove the content before sharing.

Learning 4 – Do not ask user to Copy Paste same message in Share Dialog

We wanted user to share same message and hence event team copied the message in the clipboard on the Tablet. As soon as user was asked to Share Photo on Tablet, team asked them to paste the message. Some post were going through but for some Facebook gave error – Oops Something went wrong. We’re working on getting this fixed as soon as we can.

We were not sure what was the issue. After 2 days we realised that Facebook was blocking the post if same message was Copy Pasted while posting as it was assuming it as Spam. We asked user to post custom message and everything went smooth.

Learning 5 – Prefill Hashtag or Not

Also we were prefilling HashTags in the post shared as we wanted to track the campaign. But there was a confusion whether we can prefill Hashtag or not. In prefill guideline it says that you can not add hashtag to user content but at the same time it was mentioned in other guideline that one Hashtag can be auto populated

Couple of days later Facebook blocked our App citing following reason:
We’ve placed a restriction on your app because it appears to be posting without explicit consent and creating a negative experience on Facebook.Facebook Platform Policy 2.1 requires you to obtain consent from people before publishing content on their behalf. As a reminder, when a person grants your app write permissions this is a technical grant enabling your app to create custom share options. After people grant your app a write permission, you must still obtain their permission each time your app allows them to share to Facebook. Once you’ve made changes to your app so that it no longer posts without consent, or if you think we’ve enforced on your app in error, you can appeal this decision.

We appealed the decision of Facebook explaining the whole scenario and explained that we are not auto posting. We appealed daily, but there was no response. We were unable to figure any specific reason for violation but thought below might be one of the reasons –

  1. Tablet App has a button – Post on Facebook
    Step 1 – We are capturing Login Information and saving to our database
    Step 2 – We are triggering Facebook Share Dialog after successful login and there is no separate button to again ask Share on Facebook.
    We thought that as there is no specific button asking for a call to action to share the post after login might be one of the possible reason that facebook blocked the app. We removed the step 1 and directly triggered the Step 2
  2. Prefill Hashtag – Also we talked to Facebook team and they said that it might be due to that it is combination of Hashtag with same IP but we could not get any conclusive answer. We argued that as per this guideline it is allowed to put one hashtag – facebook allows to pre fill one hashtag.

We removed Hashtag and also removed Step 1 and since then there has been no issue. We are still not sure what worked – Removing Hashtag or Reducing one step.

Learning 6 – Post were also removed if Facebook App gets blocked.

We realised that Facebook has also removed all posts which were shared using Facebook App Id. Be very cautious.

Learning 7 – Use Click Event for FB Login/Share Dialog Pop Up

Calling FB.login results in the JS SDK attempting to open a popup window. As such, this method should only be called after a user click event, otherwise the popup window will be blocked by most browsers.
Before opening share dialog first check login status(FB.getLoginStatus) and if not login then first login (FB.login) otherwise share dialog open in popup window and in that if image size is large then popup window get flickered.

Learning 8 – Track Likes of a URL
Facebook provides Rest API that help you track the likes of a given URL shared on Facebook. Though these API is deprecated on 7th August 2016. User have to migrate to Graph API but that will only provide summation of Likes, Shares. You can not get separate data for likes.

The FQL and REST APIs are no longer available in v2.1: Previously announced with v2.0, apps must migrate to versioned Graph API calls starting with v2.1.
The ‘/insights’ edge on the Application object is no longer available in this version: This has been replaced by the new ‘/app_insights’ edge.

Check more on –

Thanks for reading and I hope it was helpful.