Using Facebook Achievement API in Android

主宰稳场 提交于 2019-12-05 11:53:49

I found my own answer.

    • In order to avoid storing meta-tags in my own server, I use Facebook's Object API to create app-owned "achievement" objects (My own custom type, not the built-in "game achievement"). It can be done with the Object Browser, using your admin account: https://developers.facebook.com/tools/object-browser
    • The only thing I need to host are images (so I can populate the image URL field). If I wished to avoid even that, I could directly upload images to Facebook from my mobile app and connect them to a user-owned object (but not app-owned object).
    • 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.
    • In order to read the player's existing achievements, I use a Graph API request to read the current actions of a certain type from the player's profile. I don't need additional permissions for that: https://developers.facebook.com/docs/opengraph/using-actions/v2.2#read
    • Since I attached my custom ID property to each action, I can easily identify the player's past actions as related to my game's achievement IDs.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!