寻找android的Facebook SDK示例 [英] Looking for android Facebook SDK examples

查看:601
本文介绍了寻找android的Facebook SDK示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



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



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

解决方案

几周前,我问过一个类似的问题,关于官方的Facebook Android SDK并将内容发布到了墙上( Android / Java - 发布简单的文本到Facebook墙?)。这应该可以帮助您了解将文字发贴到墙上的感觉。我应该指出,你需要先创建一个Fackbook应用程序并从Fackbook.com申请一个API密钥( http://www.shoutmeloud.com/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\:\ +http://www.google.com+\,
+\media\:[{\type\:\image\ \ src\:\ + http://www.google.com/logos/mucha10-hp.jpg + \,\ href\:\ +http://www.google.com+\}]
+});
facebookClient.dialog(这个,stream.publish,参数,这个);

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

有关构建附件字符串的更多帮助,请访问: http://www.mobisoftinfotech.com/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 http://github.com/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.com (http://www.shoutmeloud.com/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\":\""+"http://www.google.com"+"\","
+"\"media\":[{\"type\":\"image\",\"src\":\""+"http://www.google.com/logos/mucha10-hp.jpg"+"\",\"href\":\""+"http://www.google.com"+"\"}]"
+"}");
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: http://www.mobisoftinfotech.com/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示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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