将Google Play游戏与Firebase Auth一起使用(Use Google Play Games with Firebase Auth)

编程入门 行业动态 更新时间:2024-10-17 00:26:50
将Google Play游戏与Firebase Auth一起使用(Use Google Play Games with Firebase Auth)

我的应用程序使用Firebase Auth进行身份验证(允许使用Facebook / Google / Email登录,并允许我拥有一个通用的UserID,无论他用于登录的这三个选项中的哪一个)。

我还使用Firebase实时数据库保存了一些用户数据。

我想将Leaderboard和Achievements添加到我的应用程序中。

我的疑问是:

我可以通过Firebase数据库中的“表格”手动添加排行榜和成就...但我可以使用Google Play游戏服务以任何方式执行此操作吗? (并通过Firebase Auth保持登录)。

My application is using Firebase Auth for authentication (allowing login with Facebook / Google / Email, and allowing me to have a common UserID regardless of which of these three options he used for login).

I also saved some user data using Firebase Realtime Database.

I want to add Leaderboard and Achievements to my application.

My doubt is:

I could add Leaderboard and Achievements manually via "tables" in Firebase Database... But can I do this in any way using Google Play Games Services? (and keeping login by Firebase Auth).

最满意答案

我认为有一个专门针对这个想法的完整文档。 检查将Firebase与Play游戏服务项目集成

在Google Play台中将Firebase添加到Play游戏服务项目后,您可以:

访问Google Analytics for Firebase,这是一款免费的应用衡量解决方案,可提供有关应用使用情况和用户参与度的深入见解。 通过将Play游戏事件记录到Firebase,在Google Analytics信息中心中查看您的游戏事件。 当您将Firebase添加到Play游戏服务项目时,您还将Google Play帐户与Firebase项目相关联。

解锁成就

Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ACHIEVEMENT_ID, achievementId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.UNLOCK_ACHIEVEMENT, bundle);

排行榜上的得分

Bundle bundle = new Bundle(); bundle.putLong(FirebaseAnalytics.Param.SCORE, score); bundle.putString("leaderboard_id", leaderboardId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.POST_SCORE, bundle);

您可以查看Google Analytics for Firebase信息中心中记录的事件。 您还可以通过点击游戏详细信息页面中应用图标旁边的Firebase图标直接从Play控制台访问Firebase控制台。

I think there's an entire documentation dedicated to that idea. Check Integrate Firebase with Your Play Games Services Project

When you add Firebase to your Play Game Services project in the Google Play Console, you can:

Get access to Google Analytics for Firebase, a free app measurement solution that provides insight on app usage and user engagement. View your Games events in the Analytics dashboard by logging Play Games events to Firebase. When you add Firebase to your Play Games Services project, you’re also linking your Google Play Account to your Firebase project.

Unlock achievements

Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ACHIEVEMENT_ID, achievementId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.UNLOCK_ACHIEVEMENT, bundle);

Scores on a leaderboard

Bundle bundle = new Bundle(); bundle.putLong(FirebaseAnalytics.Param.SCORE, score); bundle.putString("leaderboard_id", leaderboardId); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.POST_SCORE, bundle);

You can view the events logged in the Google Analytics for Firebase dashboard. You can also access the Firebase console directly from the Play Console by clicking the Firebase icon next to your app’s icon in the Game details page.

更多推荐

本文发布于:2023-08-01 04:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1353931.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:游戏   Play   Google   Games   Auth

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!