在Android中使用Facebook的API成就 [英] Using Facebook Achievement API in Android

查看:227
本文介绍了在Android中使用Facebook的API成就的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,这似乎是一个通用的问题,但它似乎是疯狂很难找到关于该主题的信息,所以我会AP preciate如果一个完整的例子\\指南\\源$ C ​​$ C链接某处存在。

I understand that this might seem like a generic question, but it seems to be insanely difficult to find information on the topic, so I would appreciate a complete example \ guide \ source code link if it exists somewhere.

我开发Android游戏,希望整合Facebook成就。
我想要的是,当用户完成某项拼图分享成果 - 所以它会在他们的饲料,并链接到我的应用程序显示

I am developing an Android game and would like the integrate Facebook Achievements. All I want is to share achievements when the user completes a certain puzzle - so it will show in their feed and link to my app.

这是从Facebook官方文档:
https://developers.facebook.com/docs/games/achievements

This is the official documentation from facebook: https://developers.facebook.com/docs/games/achievements

现在,当我最初开始整合Facebook的SDK,我觉得读\\写的成绩是很简单的事(这是真正的大多数游戏服务,如谷歌播放)。

Now, when I initially started integrating the Facebook SDK, I thought that reading\writing achievements is a very simple matter (which is true for most game services, like Google Play).

但好像我需要走很长的路 - 创建一些网站的HTML元数据,以便Facebook能够从中读取,定义新的Open Graph对象等 - 这似乎像这样的功能太多的工作。

But it seems like I need to go a very long way - create some website with HTML metadata so facebook can read from it, define new Open Graph objects, etc. - which seems like way too much work for such a feature.

我的问题很简单 - 没有任何明确的,用户友好的向导或示例演示了如何使用Facebook的成就与Android的游戏?
preferably,无需举办自己的网站与HTML的元数据。

My question is simple - is there any clear, user-friendly guide or example that shows how to use Facebook achievements with an Android game? Preferably, without having to host my own website with HTML metadata.

在Facebook的文档显然是一个噩梦。我从来没有像挣扎与声称提供这样一个简单的服务的SDK。 (特别是与像谷歌Play游戏服务等价的服务)。

The Facebook docs are obviously a nightmare. I've never struggled like that with an SDK that claims to offer such a simple service. (especially when compared to equivalent services like Google Play Game Services).

推荐答案

我发现我自己的答案。



    • 在为了避免在自己的服务器上存储的元标记,我使用Facebook的对象API创建的应用程序拥有的政绩的对象(我自己的自定义类型,而不是内置的游戏成就)。
      它可以与对象浏览器来完成,使用管理员帐户: https://developers.facebook.com /工具/对象的浏览器

    • 我需要主机的唯一的事情是图像(这样我就可以填充图像URL字段)。如果我希望避免甚至,我可以直接从我的移动应用程序上传图片到Facebook和它们连接到用户拥有的对象(而不是应用程序拥有的对象)。


  • 现在,我使用的成就我自己的自定义操作。我把它叫做解决(解决一个难题),它具有为我所用的自定义ID整型字段。我创建了连接解决行动,以我的之谜(成就)对象的自定义的故事。

  • 的动作定义为独一无二(不超过一个动作对象对) - 所以它确实表现得像一个成就

  • 的故事(操作对象)可以使用图形API公布:
    https://developers.facebook.com/docs/android/open-graph
    (当然,同样适用于其他平台)

  • 的动作可以被标记为明确共享(的https:/ /developers.facebook.com/docs/android/open-graph#apicalls-step4 ),以直接显示其对玩家的时间表。

  • Now, I use my own custom action for the achievements. I called it "Solve" (solve a puzzle), and it has a custom ID integer field for my own use. I created a custom story that connects the "Solve" action to my "Puzzle" (achievement) object.
  • The action is defined as "unique" (no more than one action-object pair) - so it really behaves like an achievement.
  • The story (action-object) can be published using the Graph API: https://developers.facebook.com/docs/android/open-graph (Of course, the same goes for other platforms)
  • The action can be marked as "explicitly shared" (https://developers.facebook.com/docs/android/open-graph#apicalls-step4) in order to directly show it on the player's timeline.

  • 在为了读取玩家的已有成果,我使用的是图形API请求读取玩家的个人资料某一类型的当前操作。我并不需要额外的权限:
    https://developers.facebook.com/docs/opengraph/using -actions / V2.2#读

  • 因为我重视我的自定义ID属性为每个动作,我可以轻松地识别玩家的过去的行为是关系到我的比赛的成绩的ID。

这篇关于在Android中使用Facebook的API成就的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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