寻找android的Facebook SDK示例

编程入门 行业动态 更新时间:2024-10-26 20:25:46
本文介绍了寻找android的Facebook SDK示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经浏览了整个互联网,似乎找不到我在寻找...

我只是想找到一个网站有一些例子如何使用OFFICIAL facebook android SDK github/facebook / facebook-android-sdk

具体来说,我想看一些关于通知使用和简单照片上传的示例。但我会采取任何行动来帮助您了解使用SDK的感觉。

如果有人知道任何例子,请分享谢谢!

解决方案

几周前,我问过一个类似的问题,关于官方的Facebook Android SDK并将内容发布到了墙上( Android / Java - 发布简单的文本到Facebook墙?)。这应该可以帮助您了解将文字发贴到墙上的感觉。我应该指出,你需要先创建一个Fackbook应用程序并从Fackbook申请一个API密钥( www.shoutmeloud/how-to-acquire-your-facebook-api-key.html )...如果它询问您打算创建的应用程序的平台,选择手机。

您可以修改我发布(上面)的Stack Overflow链接中的代码来发布照片。目前,根据Facebook Android SDK的官方git页面(已知问题):

3.二进制API参数(如上传图片)尚未支付 - 即将推出...

所以,当你可以发布如果您有图像文件的URL(文件必须已在Internet上),您的墙壁上会显示一张照片,则无法使用此SDK从Android设备发送照片的二进制/字节数据截至07/24/10)。至少这是我从上面的声明中收集的。

替换我在另一个Stack Overflow文章(以上链接)中发布的示例代码的以下行: p>

Bundle parameters = new Bundle(); parameters.putString(message,这是一个测试); //要发送到墙上的消息 facebookClient.dialog(这个,stream.publish,参数,这个); //stream.publish是一个API调用

与此

Bundle parameters = new Bundle(); parameters.putString(message,Test Photo); parameters.putString(附件,{\name\:\我的测试图像, +\href\:\ +www.google+\, +\media\:[{\type\:\image\ \ src\:\ + www.google/logos/mucha10-hp.jpg + \,\ href\:\ +www.google+\}] +}); facebookClient.dialog(这个,stream.publish,参数,这个);

您应该可以将照片发布到您的墙上(以及文字和链接) / p>

有关构建附件字符串的更多帮助,请访问: www.mobisoftinfotech/blog/android/845/ 。

除此之外,请考虑使用如果您需要从设备直接发布照片到相册,请等待官方SDK的更新。

我希望有所帮助。 >

I've looked all over the internet and can't seem to find what i'm looking for...

I'm just trying to find a site with some examples on how to use the OFFICIAL facebook android SDK github/facebook/facebook-android-sdk

To be specific i'd like to see some examples on notification use and simple photo upload. But i'll take anything to help get a feel for using the SDK.

If anyone knows of any examples please share thank you so much!

解决方案

I asked a similar question a few weeks ago regarding the official Facebook Android SDK and posting content to one's wall (Android/Java -- Post simple text to Facebook wall?). That should help you get a feel for what it's like to post text to one's wall. I should point out though that you need to first create a Fackbook app and apply for an API key from Fackbook (www.shoutmeloud/how-to-acquire-your-facebook-api-key.html)...if it asks about the platform of the app you intent to create, choose mobile.

You can modify the code in the Stack Overflow link I posted (above) to post photos too. At present though, according to the official git page for the Facebook Android SDK (under "Known Issues"):

3.Binary API parameters (such as uploading pictures) is not yet supported -- coming soon...

So, while you can post a photo to your wall if you have the URL of the image file (the file must already be on the Internet), you can't use this SDK to send binary/byte data of the photo from the Android device (yet... as of 07/24/10). At least, that's what I gather from the statement above.

Replace the following lines of the sample code I posted in the other Stack Overflow post (link above):

Bundle parameters = new Bundle(); parameters.putString("message", "this is a test");// the message to post to the wall facebookClient.dialog(this, "stream.publish", parameters, this);// "stream.publish" is an API call

with this

Bundle parameters = new Bundle(); parameters.putString("message", "Test Photo"); parameters.putString("attachment", "{\"name\":\"My Test Image\"," +"\"href\":\""+"www.google"+"\"," +"\"media\":[{\"type\":\"image\",\"src\":\""+"www.google/logos/mucha10-hp.jpg"+"\",\"href\":\""+"www.google"+"\"}]" +"}"); facebookClient.dialog(this, "stream.publish", parameters, this);

and you should be able to post photos to your wall (as well as text and links).

For more help on structuring the "attachment" string, go here: www.mobisoftinfotech/blog/android/845/.

Other than that, consider using a third-party package or wait for the official SDK to be updated if you need to post photos to an album directly from the device.

I hope that helps.

更多推荐

寻找android的Facebook SDK示例

本文发布于:2023-07-28 00:13:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225576.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:示例   android   Facebook   SDK

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!