Android-Facebook SDK: No se puede compartir fotos, el diálogo no se muestra

Esta es la primera vez que uso el SDK de Android-Facebook. Estoy intentando publicar un mapa de bits pero sigo recibiendo este mensaje:

Warning: Error: com.facebook.FacebookException: Failed to copy image. 

Puedo publicar enlaces simples, pero no los que tienen fotos.

¿Cómo debo arreglar esto? Además, una cosa que noté es que el StatusCallback.call () no está siendo llamado.

 public abstract class FacebookReadyBaseActivity extends Activity { private static final String TAG = "FacebookReadyBaseActivity"; private UiLifecycleHelper uiHelper; protected PendingAction pendingAction = PendingAction.NONE; private static final String PERMISSION = "publish_actions"; protected boolean canPresentShareDialogWithPhotos; private boolean canPresentShareDialog; private GraphUser user; private GraphPlace place; private List<GraphUser> tags; protected Bitmap pendingBitmap; protected enum PendingAction { NONE, POST_PHOTO, POST_STATUS_UPDATE } private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onCreate(savedInstanceState); canPresentShareDialog = FacebookDialog.canPresentShareDialog(this, FacebookDialog.ShareDialogFeature.SHARE_DIALOG); canPresentShareDialogWithPhotos = FacebookDialog.canPresentShareDialog( this, FacebookDialog.ShareDialogFeature.PHOTOS); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { Log.e(TAG, String.format("Error: %s", error.toString())); } @Override public void onComplete( FacebookDialog.PendingCall pendingCall, Bundle data) { Log.i(TAG, "Success!"); } }); } @Override protected void onResume() { super.onResume(); uiHelper.onResume(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } protected UiLifecycleHelper getFacebookUiHelper() { return uiHelper; } protected void performPublish(PendingAction action, boolean allowNoSession) { Session session = Session.getActiveSession(); if (session != null) { pendingAction = action; if (hasPublishPermission()) { // We can do the action right away. handlePendingAction(); return; } else if (session.isOpened()) { // We need to get new permissions, then complete the action when // we get called back. session.requestNewPublishPermissions(new Session.NewPermissionsRequest( this, PERMISSION)); return; } } if (allowNoSession) { pendingAction = action; handlePendingAction(); } } private boolean hasPublishPermission() { Session session = Session.getActiveSession(); return session != null && session.getPermissions().contains("publish_actions"); } @SuppressWarnings("incomplete-switch") private void handlePendingAction() { PendingAction previouslyPendingAction = pendingAction; // These actions may re-set pendingAction if they are still pending, but // we assume they // will succeed. pendingAction = PendingAction.NONE; switch (previouslyPendingAction) { case POST_PHOTO: postPhoto(); break; case POST_STATUS_UPDATE: postStatusUpdate(); break; } } private void postPhoto() { if (canPresentShareDialogWithPhotos) { FacebookDialog shareDialog = createShareDialogBuilderForPhoto( pendingBitmap).build(); uiHelper.trackPendingDialogCall(shareDialog.present()); } else if (hasPublishPermission()) { Request request = Request.newUploadPhotoRequest( Session.getActiveSession(), pendingBitmap, new Request.Callback() { @Override public void onCompleted(Response response) { InfoDialog.newInstance( FacebookReadyBaseActivity.this, "Done", "Photo share finished.", null).show(); } }); request.executeAsync(); } else { pendingAction = PendingAction.POST_PHOTO; } } private void postStatusUpdate() { if (canPresentShareDialog) { FacebookDialog shareDialog = createShareDialogBuilderForLink() .build(); uiHelper.trackPendingDialogCall(shareDialog.present()); } else if (user != null && hasPublishPermission()) { // TODO fixme final String message = "Status update finished."; Request request = Request.newStatusUpdateRequest( Session.getActiveSession(), message, place, tags, new Request.Callback() { @Override public void onCompleted(Response response) { InfoDialog.newInstance( FacebookReadyBaseActivity.this, "Done", message, null).show(); } }); request.executeAsync(); } else { pendingAction = PendingAction.POST_STATUS_UPDATE; } } private FacebookDialog.PhotoShareDialogBuilder createShareDialogBuilderForPhoto( Bitmap... photos) { return new FacebookDialog.PhotoShareDialogBuilder(this) .addPhotos(Arrays.asList(photos)); } private FacebookDialog.ShareDialogBuilder createShareDialogBuilderForLink() { return new FacebookDialog.ShareDialogBuilder(this) .setName("Hello Facebook") .setDescription( "The 'Hello Facebook' sample application showcases simple Facebook integration") .setLink("http://developers.facebook.com/android"); } private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (pendingAction != PendingAction.NONE && (exception instanceof FacebookOperationCanceledException || exception instanceof FacebookAuthorizationException)) { InfoDialog.newInstance(FacebookReadyBaseActivity.this, "Failed", "Not granted.", null).show(); pendingAction = PendingAction.NONE; } else if (state == SessionState.OPENED_TOKEN_UPDATED) { handlePendingAction(); } } } 

One Solution collect form web for “Android-Facebook SDK: No se puede compartir fotos, el diálogo no se muestra”

Finalmente lo consiguió para trabajar!

En el proyecto HelloFacebookSample proporcionado, vi esto en el manifiesto:

  <provider android:authorities="com.facebook.app.NativeAppCallContentProvider355198514515820" android:name="com.facebook.NativeAppCallContentProvider" android:exported="true"/> 

Simplemente cambié la parte de número usando mi propio ID de aplicación de Facebook. No sé por qué no vi esto en la documentación.

EDITO Se ha encontrado esto después: https://developers.facebook.com/docs/reference/android/current/class/NativeAppCallContentProvider/

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.