简体   繁体   English

如何在Android应用程序中集成Facebook API?

[英]how to integrate Facebook API in Android Application?

I am developing a mobile social TV application on Android.I want to integrate Facebook with my application so that I can: 我正在Android上开发移动社交电视应用程序。我想将Facebook与我的应用程序集成,以便我可以:

  1. Share things on Facebook 在Facebook上分享内容
  2. Send request to friends on Facebook to join the application 在Facebook上向朋友发送请求以加入该应用程序

You may use this. 你可以用它。

Facebook Android SDK Facebook Android SDK

But carefull about handling activity result. 但是关于处理活动结果的仔细。 If you test integration in simulator you haven't installed facebook app. 如果你在模拟器中测试集成,你还没有安装facebook app。 and sdk will show you a dialog with webview. 和sdk会显示一个webview对话框。 But on a real phone if facebook app. 但在真正的手机上,如果Facebook应用程序。 is installed, authorization will go via app. 已安装,授权将通过应用程序。

you need to install an extension, similar to the core Android SDK, but no, here is what you need to do: 你需要安装一个扩展,类似于核心Android SDK,但不,这是你需要做的:

1.) go to https://github.com/facebook/facebook-android-sdk 1.)转到https://github.com/facebook/facebook-android-sdk

2.) download the facebook directory ONLY! 2.)仅下载facebook目录! The other directories are only examples. 其他目录仅是示例。

3.) Put the files from the src (you can copy the drawables too, if you want to) in the package, you are currently working with 3.)放入src中的文件(你也可以复制drawables,如果你想),你当前正在使用

4.) You are good to go, you can use the facebook "SDK" 4.)你很高兴,你可以使用facebook“SDK”

see also these examples https://github.com/facebook/facebook-android-sdk/tree/master/samples , it is working example provided by facebook 另请参阅这些示例https://github.com/facebook/facebook-android-sdk/tree/master/samples ,这是facebook提供的工作示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM