Android - Share custom link via facebook

前端 未结 3 1157
没有蜡笔的小新
没有蜡笔的小新 2021-01-07 04:48

I need to share specific part in my app when user open it , if he download my app it navigate direct to this part (it may be nested fragment).

String AppURL          


        
3条回答
  •  灰色年华
    2021-01-07 05:16

    In order to share the something in Facebook better go with latest Facebook SDK. It will make your task simpler. Because Android Intent has its own restrictions when we use share to facebook. Refer my answer below regarding this

    Share text via Intent on Facebook without using Facebook sdk

    The screenshot that you posted seems to have the sharing of link from the App.

    Here is how you will integrate the Facebook SDK to your project.

    Facebook SDK integration

    Then use the following code to share link on the facebook.

    ShareDialog shareDialog;
    FacebookSdk.sdkInitialize(Activity.this);
    shareDialog = new ShareDialog(act);
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
                        .setContentTitle("title")
                        .setContentDescription(
                                "Description")
                        .setContentUrl(Uri.parse("your url")).build();
                shareDialog.show(linkContent);
    

    More sharing options from Facebook can be found here, which is pretty simple and straightforward.

    Happy coding..!!

提交回复
热议问题