Get User ID From Google Play Games API?

≯℡__Kan透↙ 提交于 2020-02-25 06:56:06

问题


I'd like to be able to link users in one game to users in another game such that users that unlock certain achievements in game 1 are able to receive special items in game 2. This is very similar to how Blizzard does it where buying like X in Hearthstone gives you a special mount in WoW.

I know we could manage our own account system but we're hoping there's an easy way around that.

I've been researching Google Play Games and it seems like that could be the ticket but I can't seem to figure out a good way to identify that this new user linked in Google Play Games is the same user as in Game 1. Is this something I can accomplish with the SDK? Basically wondering if playerId is unique to the game or to the player themselves and across different devices.

(another option would be using the Google Play Advertising ID, but that isn't great for users that want to enabled limited ad tracking).


回答1:


developer.android.com has a whole article on user identifiers. What you've got is a hard problem. I can give you a few tips:

  • playerId is the same for the same user across different devices, but is different between different games. This is deliberate to prevent Ad tracking that the user didn't intend. So playerId would probably be the wrong choice.
  • The Advertising id is "for user profiling or ads use-cases". So I definitely wouldn't use it for this use case.

In this case, my choice would be to use something like Firebase, especially Firebase Auth to manage a very simple account system. You won't need to create your own servers or write much sign-in code as Firebase handles this, and you get sign-in with Google or Facebook for free. And once you have it, it will give you a nice flexible way to do other things in future, eg experiments or configuration with Firebase Remote Config. And it is cross-platform if you ever write an iOS version, and from Google.



来源:https://stackoverflow.com/questions/52264836/get-user-id-from-google-play-games-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!