How to Implement Facebook App Link in Android with Example

Can I post to Facebook from my Android app and this post feature is called an app link? If someone using the Facebook app listens to this post, will it be directed to GP to install my app, and if installed, will it open my app with enough data to view this post in my app activity?

Until now, I could not find an example that shows how to create an App Link object, and how to include data in this object to be retrieved later from intent -> additional functions, and I am completely confused how to implement it in Android.

For example, from my application, I want to share the link http://youtube.com/xxxxx in a post on Facebook, how to create a link to the application using the Facebook App Link host function?

Edit 1:

I need to understand something in relation to app connectivity, am I creating an app link for every post that will be posted from my app, or is the app link generated once to represent my app?

Edit 2:

How do I get my app name to be blue like Instagram and clicking on it opens my app or goes to my Google Play to install if not installed

How to get my app name to be in Blue as Instagram and clicking on it opens my application or go to my

Edit 3:

This is the code I am using to share, but I am not getting my app name as "clickable blue link" like Instagram like in the picture:

    ShareDialog shareDialog = new ShareDialog(mMainActivity);

    if (ShareDialog.canShow(ShareLinkContent.class))
    {
        ShareLinkContent linkContent;
        if(aURL == null)
        {
            linkContent = new ShareLinkContent.Builder().build();
        }
        else
        {
            linkContent = new ShareLinkContent.Builder()
                    .setContentUrl(Uri.parse(aURL))
                    .build();
        }

        shareDialog.show(linkContent);
    }

      

Can I make specific changes to my app's settings page in the Facebook dashboard?

+3


source to share


3 answers


You have to use open actions for this. first you have to create an object. then add the action type. then you need to create a story. and you have to submit your facebook application process for review. Typically the general code looks like this. read the docs https://developers.facebook.com/docs/sharing/opengraph/android . and you need to use app links - https://developers.facebook.com/docs/applinks/android



// Create an object
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
    .putString("og:type", "books.book")
    .putString("og:title", "A Game of Thrones")
    .putString("og:description", "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.")
    .putString("books:isbn", "0-553-57340-3")
    .build();

// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
    .setActionType("books.reads")
    .putObject("book", object)
    .build();

// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
    .setPreviewPropertyName("book")
    .setAction(action)
    .build();

ShareDialog.show(activityOrFragment, content);

      

+1


source


If I understand your question correctly, you want to post it to facebook (URL) from your application. What you can do is:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, your_link_here );  
startActivity(Intent.createChooser(intent, "Share via"));

      



This will open a list of apps where you can share your link, which includes the facebook app if installed. Also take a look at facebook TOS. You cannot pre-fill the post as it is against their policy. If you want to share some text along with your url, you will have to use the facebook SDK.

0


source


I tried the same. It turns out your app needs to be present in the app center (facebook). Then only it will turn into a blue link.

In my case, I tried to click a link, but it landed on a page that said:

Misconfigured App Sorry, My App is not approved for display in the App Center.

So I got a hint from that.

0


source







All Articles