我一直在試圖創建一個解決方案,共享一個位圖圖像,特別是一個屏幕截圖。我一直在關注這個解決方案 - >How to post Bitmap to facebook using facebook sdk?使用Facebook SDK 3.15。如何共享位圖
因此,這是我的代碼,
@SuppressWarnings("deprecation")
private void shareToFacebook(Bitmap img) {
if (img != null) {
Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), img, uploadPhotoRequestCallback);
Bundle parameters = request.getParameters(); // <-- THIS IS IMPORTANT
parameters.putString("DriveSync Telematics", "Wow look at my Score!");
// add more params here
request.setParameters(parameters);
request.executeAsync();
}
}
隨着回調是
Request.Callback uploadPhotoRequestCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
if (response.getError() != null) {
//post error
} else{
String idRploadResponse = (String) response.getGraphObject().getProperty("id");
if (idRploadResponse!= null) {
String fbPhotoAddress = "https://www.facebook.com/photo.php?fbid=" +idRploadResponse;
} else {
Log.d(TAG, "Facebook upload failed");
}
}
}
};
而且我收到此錯誤
java.lang.IllegalArgumentException: A property named "My Score" was not found on the action. The name of the preview property must match the name of an action property.
有誰知道這意味着什麼/我如何解決我的問題。
感謝,
彼得,
有一個新的相關問題http://stackoverflow.com/問題/ 24417668/error-when-using-facebookdialog-photosharedialogbuilder –