2
我在我的應用程序中共享Facebook OpenGraph內容時遇到了一個問題。我已經仔細閱讀Facebook的開發者頁面這是有據可查的,但我還是有這個錯誤...Facebook OGraph照片清單錯誤與Android
這裏是我的代碼:
private void facebookShareWithOpenGraph(final SmartRunFirebase aSmartRun, final StatisticSmartRun stats){
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(aSmartRun.getAffectedCity().getCityPicture())
.setUserGenerated(true)
.build();
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "fitness.course")
.putString("og:title", aSmartRun.getName())
.putString("og:description", aSmartRun.getDescription())
.putPhoto("og:image", photo)
.putInt("fitness:duration:value", stats.getChronoInSecond())
.putString("fitness:duration:units", "s")
.putDouble("fitness:distance:value", (double) stats.getTravelledDistance()/1000)
.putString("fitness:distance:units", "km")
.putDouble("fitness:speed:value", statCalculator.parseInMeterPerSecond(stats.getMediumSpeed()))
.putString("fitness:speed:units", "m/s")
.build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("fitness.runs")
.putObject("fitness:course", object)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("fitness:course")
.setAction(action)
.build();
// ShareDialog.show(StatsSmartRunsActivity.this, content);
// initiate share process
ShareDialog shareDialog = new ShareDialog(this);
shareDialog.show(content);
}
在我的清單
<provider android:authorities="com.facebook.app.FacebookContentProviderXXXXXXXAppID"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
無使用.putPhoto添加圖片一切都很好。但是當我添加它時,我有一個崩潰到線shareDialog.show(內容);:
java.lang.IllegalStateException: A ContentProvider for this app was not set up in the AndroidManifest.xml, please add com.facebook.app.FacebookContentProviderXXXXXXXX as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.
這怎麼可能?它寫在我的清單中!如果我的提供程序沒有正確定義,我怎麼能分享我的OpenGraph沒有圖片?
非常感謝你提前:)