There's two ways of doing this.
1. Create a native plugin, write wrapper code in Unity to call the native code (Probably the most widely used way to call native functions)
2. Write the code entirely in Unity, and use AndroidJavaObject to invoke the functions.
Option 1 - Native Java Code + Unity Wrapper
Here's a link I found on SO for the code for Sharing.
Here's a link to one of my older answers about plugins. You can modify the code there to fit your needs.
Option 2 - No native code.
This way is a little more interesting. We use Unity's AndroidJavaClass & AndroidJavaObject to eliminate the need of JARs altogether. Just stick the below code in a C# script, and call the function. (NOTE, I haven't tried this code, there may be errors. If there are, let me know and I'll edit my response)
private static AndroidJavaObject activity = null;
private static void CreateActivity () {
#if UNITY_ANDROID && !UNITY_EDITOR
if(activity == null)
activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").
GetStatic<AndroidJavaObject>("currentActivity");
#endif
}
public static void ShareActivity (string title, string subject, string body) {
CreateActivity();
AndroidJavaObject sharingIntent = new AndroidJavaObject("android.content.Intent", "android.intent.action.SEND")
.Call<AndroidJavaObject>("setType", "text/plain")
.Call<AndroidJavaObject>("putExtra", "android.intent.extra.TEXT", body)
.Call<AndroidJavaObject>("putExtra", "android.intent.extra.SUBJECT", subject);
AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", activity)
.CallStatic<AndroidJavaObject>("createChooser", sharingIntent, title);
activity.Call("startActivity", intent);
}
Don't forget to add the activity to your AndroidManifest.xml!