Facebook - StansAssets/com.stansassets.android-native GitHub Wiki

This guide shows you how to implement Facebook sharing API using the Android Native API.

You can share only share the image or images on Facebook, there is no text option, because due to a Facebook policy the predefined sharing text is not allowed, and will be ignored by the Facebook app anyway.

For this example, we will be taking the app screen screenshots using SA_ScreenUtil.TakeScreenshot method. However, you can use any image or images you like. The only limitation, this image has to be readable.

using SA.Android.Social;
...

SA_ScreenUtil.TakeScreenshot((screenshot) => {
    var composer = new AN_FacebookSharing();
    composer.AddImage(screenshot);
    composer.AddImage(screenshot);

    composer.Share(() => {
        Debug.Log("Sharing flow is finished, User has retured to the app");
    });
});

Please note, that you can use native sharing only if the application you want to share with is installed on a user device. Can check this using the example below:

bool IsAppInsatlled = AN_FacebookSharing.IsAppInsatlled;