分享图像,并使用Facebook的SDK来我的Andr​​oid应用程序的链接 [英] Share an image and a link to my android app using Facebook sdk

查看:266
本文介绍了分享图像,并使用Facebook的SDK来我的Andr​​oid应用程序的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我为Android相机应用我想与大家分享由用户带到用户的Facebook墙上的照片。我想它有:


  1. 的文字说明由用户(在shareDialog等)书面

  2. 用我的相机应用所拍摄的影像

  3. 链接到图像本身在专辑(刷卡到previously上传的)

  4. 某些文本(标题+说明)关于我的应用程序

  5. 在谷歌到我的应用程序的链接(带图标?)玩

下面就是我想要的一个画面:(鸣叫到Facebook的职位非常相似,这一点,所以我认为这是可以做到!)

如何实现这一目标?结果
我应该使用的Open Graph?结果
我尝试以下developers.facebook教程,但我失败了!我认为样品是越野车!这是非常令人沮丧的......

请帮帮忙,我需要有人来告诉我正确的方式!

修改

其实这是我的code,没有照片所示:

 私人无效shareWithFacebookOpenGraph(字符串映像路径){
    Log.i(SHARE,1. OpenGraph股);
    OpenGraphObject照片= OpenGraphObject.Factory.createForPost(的myapp:照片);
    photo.setProperty(称号,MyApp的照片);
    photo.setProperty(图像,http://play.google.com/to_my_app_launcher_icon);
    photo.setProperty(URL,http://play.google.com/to_my_app);
    photo.setProperty(说明,图像采取对myApp为Android);    清单<文件>文件=新的ArrayList<文件>();
    files.add(新文件(映像路径));    OpenGraphAction行动= GraphObject.Factory.create(OpenGraphAction.class);
    action.setProperty(照片,照片);    FacebookDialog shareDialog =新FacebookDialog.OpenGraphActionDialogBu​​ilder(这一点,行动的myapp:取,照片)
        //.setImageAttachmentFilesForObject(\"image,文件,真正的)//错误:图像不是属性
        //.setImageAttachmentFilesForAction(files,真)//错误共享pictue:空
        //.setImageAttachmentFilesForObject(\"photo,文件,TRUE)//不能创建集(?!?!)
        。建立();
    uiHelper.trackPendingDialogCall(shareDialog present());
}


解决方案

尝试使用在共享对话框成立的Open Graph。这样,一旦你成功了,你不必经过许可审查:的Andr​​oid共享

In my camera app for Android i would like to share a photo taken by the user to the user's facebook wall. I would like it has:

  1. a text description written by the user (like in a shareDialog)
  2. the image taken with my camera app
  3. the link to the image itself in the album (to swipe to the previously uploaded ones)
  4. some text (caption+description) about my app
  5. a link to my app (with icon?) in google play

Here's a picture of what i want: (tweet-to-facebook posts are very similar to this, so i think it can be done!)

How to achieve this?
Should i use Open Graph?
I tried following developers.facebook tutorials, but i failed!! i think samples are buggy! It's very frustrating...

Please help, i need someone to show me the right way!

EDIT

actually this is my code, no foto is shown:

private void shareWithFacebookOpenGraph(String pathToImage) {
    Log.i("SHARE", "1. share with OpenGraph");  
    OpenGraphObject photo = OpenGraphObject.Factory.createForPost("myapp:photo");
    photo.setProperty("title", "MyApp Photo");
    photo.setProperty("image", "http://play.google.com/to_my_app_launcher_icon");
    photo.setProperty("url", "http://play.google.com/to_my_app");
    photo.setProperty("description", "Image taken with myApp for Android");

    List<File> files = new ArrayList<File>();
    files.add(new File(pathToImage));

    OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
    action.setProperty("photo", photo);

    FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "myapp:take", "photo")
        //.setImageAttachmentFilesForObject("image", files, true)  // Error: image is not a property
        //.setImageAttachmentFilesForAction(files, true)        // Error sharing pictue: null
        //.setImageAttachmentFilesForObject("photo", files, true) // can't create Collection (?!?!)
        .build();
    uiHelper.trackPendingDialogCall(shareDialog.present());
}

解决方案

Try using Open Graph incorporated in the Share Dialog. This way, once you succeed, you don't have to go through permission review: Android Sharing

这篇关于分享图像,并使用Facebook的SDK来我的Andr​​oid应用程序的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆