3
votes

I share a link using the share dialog from the Facebook Android SDK. My code looks like this:

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
          .setName("My app name")
          .setCaption("A caption")
          .setDescription("My description...")
          .setLink("https://play.google.com/store/apps/details?id=com.company.myapp")
          .setPicture("http://link_to_picture")
          .build();

As I want users to be redirected to my app's Play Store page, I put this url in the link. But in that case, the post doesn't show the information I specified (name, caption, description). Instead, it shows the app name specified in the Play Store, with a "download it" caption (the picture is ok).

When I set another link, this issue doesn't occur: the post displays the name, caption and description as expected. Why can't I put my own text with a Play Store link?

EDIT

I tried using App Links. So I created an App Link object with this:

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
    {
      "url" : "myapp://share/1234",
      "package" : "com.company.myapp",
      "app_name" : "My app",
    },
 ]' \
-F web=' {
    "should_fallback" : false,
  }'

And I got this url: https://fb.me/494085890722766

Now, the post looks good, but clicking on it from Facebook app when my app is not installed pops up a chooser that proposes to open the link in a browser or install the application, which is not a good user experience.

3
Hi, Can you tell me how you got this "fb.me/494085890722766" URL ? What do we need to do get App Link? Steps for it or procedure? Do I need to create a new html page on my website for the same?gprathour
How do we run the curl code? what is APP_ACCESS_TOKEN and what to write in place of "myapp://share/1234"gprathour
To create your App Link object, follow instructions described here: developers.facebook.com/docs/applinks/hosting-api You get your app token, read this: developers.facebook.com/docs/facebook-login/… Curl is a command line tool that you can use to make HTTP POST requests.Superthib
@Superthib, one quick question, what did you do with the generated url, "fb.me/494085890722766"? the documentation seem to suggest nothing about it.Kaps

3 Answers

0
votes

Finally, I found a workaround using App Links, which is detailed here : https://developers.facebook.com/docs/applinks/hosting-api

I created my App Link object without any "-F web" parameter, like this:

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
    {
      "url" : "myapp://share/1234",
      "package" : "com.company.myapp",
      "app_name" : "My app",
    },
 ]'

However, I don't understand why Facebook API works in a so weird way. It's a complicated solution to a simple issue.

0
votes

Replace your link with

 .setLink("market://details?id=com.company.myapp")

See this link

0
votes

In my case, I disable DeepLink in Facebook Developer Console and it work well.