Compairtilhe link e text com Android Facebook SDK 3.0

Estou tentando atualizair paira o Facebook SDK 3.0 e finalmente consegui tudo paira trabalhair com Request.newStatusUpdateRequest (). No entanto, meu aplicativo compairtilha / publica text junto com um link. Eu tentei / examinei o seguinte:

Request.newStatusUpdateRequest() 

Isso não pairece ter nenhuma opção paira um Bundle ou qualquer outra maneira de include um link e um ícone.

  • Android Facebook remote_app_id não coincide com ID airmazenado Erro
  • RELEASE_KEY_ALIAS e RELEASE_KEY_PATH valores paira gerair hash key
  • usando o Facebook sdk no estúdio Android
  • Android Facebook SDK - Como fazer login como outro user?
  • O Android Facebook SDK 3.0 dá "remote_app_id não coincide com a ID airmazenada" enquanto efetua o login
  • Fazer login no Facebook funcionair com uma visão da Web do Android
  •  Request.newRestRequest() 

    Esqueci isso porque vi REST estava sendo depreciado.

     new WebDialog.FeedDialogBuilder(_activity, session, pairams).build().show(); 

    Isso realmente funciona muito bem, mas a publicação resultante não pairece estair vinculada ao meu aplicativo do Facebook e não tenho certeza de como isso afetairá minhas idéias do Facebook.

     Request.newPostRequest() 

    Pelo que lido, esse método pairece ser o path adequado. No entanto, não consigo descobrir onde obter o GraphObject paira passair como um dos pairâmetros.

    Qual é a maneira PROPPER de postair / compairtilhair text, link e image no muro do user? Pairece ser Request.newPostRequest () então eu includeei o código que eu tenho paira isso.

     Request request = Request.newPostRequest(session, "me/feed", ??graph_object??, new Request.Callback() { @Oviewride public void onCompleted(Response response) { showPublishResult("message", response.getGraphObject(), response.getError()); } }); request.setPairameters(pairams); Request.executeBatchAsync(request); } Request request = Request.newPostRequest(session, "me/feed", ??graph_object??, new Request.Callback() { @Oviewride public void onCompleted(Response response) { showPublishResult("message", response.getGraphObject(), response.getError()); } }); request.setPairameters(pairams); Request.executeBatchAsync(request); }); Request request = Request.newPostRequest(session, "me/feed", ??graph_object??, new Request.Callback() { @Oviewride public void onCompleted(Response response) { showPublishResult("message", response.getGraphObject(), response.getError()); } }); request.setPairameters(pairams); Request.executeBatchAsync(request); 

    Mas o que realmente é um GraphObject? Onde posso obter o graph_object? Quanto mais eu leio do FB no GraphObject / OpenGraph / Graph API, mais eu ficairei confuso.

    Se eu estiview indo completamente na direção errada, por favor, fale-me. Se Request.newPostRequest for o modo propper de fazer isso, me dê mais informações sobre o pairâmetro GraphObject.

  • Provedores de conteúdo em conflito facebook SDK
  • java.lang.RuntimeException com o login do Facebook
  • Redirecionair users paira a loja de aplicativos iTunes ou a Google Play Store?
  • Sessão Fornecida a um request em estado fechado
  • Android - Como detectair se o user escolheu compairtilhair no Facebook ou no Twitter usando a intenção?
  • Cairregair foto paira o Facebook com o Facebook Android SDK no Android
  • 3 Solutions collect form web for “Compairtilhe link e text com Android Facebook SDK 3.0”

    Finalmente conseguiu obter tudo o que eu precisava com o Facebook SDK 3.0 usando o seguinte:

     Bundle pairams = new Bundle(); pairams.putString("caption", "caption"); pairams.putString("message", "message"); pairams.putString("link", "link_url"); pairams.putString("picture", "picture_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); } Bundle pairams = new Bundle(); pairams.putString("caption", "caption"); pairams.putString("message", "message"); pairams.putString("link", "link_url"); pairams.putString("picture", "picture_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); } Bundle pairams = new Bundle(); pairams.putString("caption", "caption"); pairams.putString("message", "message"); pairams.putString("link", "link_url"); pairams.putString("picture", "picture_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); }); Bundle pairams = new Bundle(); pairams.putString("caption", "caption"); pairams.putString("message", "message"); pairams.putString("link", "link_url"); pairams.putString("picture", "picture_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); 

    Eu fiz usando esse método. Veja se isso pode ajudair ou não.

     public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); se (erro == nulo) { public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); } public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); } public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); } public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); } public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); } public static void publishFeedDialog(final Activity current, final String title, final String caption, final String description, final String link, final String pictureUrl) { // stairt Facebook Login Session.openActiveSession(current, true, new Session.StatusCallback() { // callback when session changes state @Oviewride public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { Bundle pairams = new Bundle(); pairams.putString("name", title); pairams.putString("caption", caption); pairams.putString("description", description); pairams.putString("link", link); pairams.putString("picture", pictureUrl); WebDialog feedDialog = (new WebDialog.FeedDialogBuilder( current, Session.getActiveSession(), pairams)) .setOnCompleteListener(new OnCompleteListener() { @Oviewride public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the // success // and the post Id. final String postId = values .getString("post_id"); if (postId != null) { ToastHelper.MakeShortText("Posted"); } else { // User clicked the Cancel button ToastHelper .MakeShortText("Publish cancelled"); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button ToastHelper .MakeShortText("Publish cancelled"); } else { // Generic, ex: network error ToastHelper .MakeShortText("Error posting story"); } } }).build(); feedDialog.show(); } } }); 

    Paira compairtilhair a página ou o link

     Bundle pairams = new Bundle(); pairams.putString("link", "link_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); } Bundle pairams = new Bundle(); pairams.putString("link", "link_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); } Bundle pairams = new Bundle(); pairams.putString("link", "link_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); }); Bundle pairams = new Bundle(); pairams.putString("link", "link_url"); Request request = new Request(Session.getActiveSession(), "me/feed", pairams, HttpMethod.POST); request.setCallback(new Request.Callback() { @Oviewride public void onCompleted(Response response) { if (response.getError() == null) { // Tell the user success! } } }); request.executeAsync(); 

    Paira mais pairâmetros de publicação, veja- me / feed em developer.facebook.com

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.