I'm trying to share a content URL and send it over to facebook. I've been following the official documentation I have the dependencies in grade and I have the following in my Manifest file
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<provider android:authorities="com.facebook.app.FacebookContentProvider247315745828416"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
</application>
I can log in to my app using facebook fine. In my code I call the share content by doing the following
private void uploadToFacebook(){
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.build();
shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
toastMessage("Done");
}
When I run the code without shareDialog.show() the toast message appears but the url is not send over to my facebook wall.
When I inclide shareDialog.show() the application crashes and I get a null pointer exception on it.
The content is definitely an object as I get a value back when I convert it to a string I get
com.facebook.share.model.ShareLinkContent@c63dc77
I am using android version 2.3.3 any help would be greatly appreciated as I can't seem to grasp what I've done wrong. I have a key hash stored for as well.