Android - 分数没有被提交给排行榜 [英] Android - score not being submitted to a leaderboard

查看:185
本文介绍了Android - 分数没有被提交给排行榜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我添加了排行榜到我的Android项目,一切正常,直到我试图提交分数。 Google Play服务配置正确,我可以查看排行榜,但无法提交。

  Games.Leaderboards.submitScoreImmediate(getApiClient(), String.valueOf(R.string.leaderboard_id),score); 

由于我怀疑错误是来自该行的visibe,并且由于logcat不显示与提交分数相关的数据,所以我我想知道如何检查分数是否正确提交。
Thanks。

解决方案

我对提交排行榜的分数不太了解 - 但错误可能是从您的行中可见:

  String.valueOf(R.string.leaderboard_id)

不会给你在某些strings.xml文件中指定的字符串,而是包含该字符串的内部android id的字符串,例如1234567。要从文件中获取字符串,您应该使用

  getContext()。getString(R.string.leaderboard_id)


Recently, I've added leaderboards to my Android project and everything worked fine until I tried to submit score to it. Google Play Services are configured correctly and I can view the leaderboard but I cannot submit

 Games.Leaderboards.submitScoreImmediate(getApiClient(),String.valueOf(R.string.leaderboard_id), score);   

Since i doubt error is visibe from that line and since logcat displays no data related to score submission, i am wondering how to check is the score was submitted correctly. Thanks.

解决方案

I don't know much about the score submission to the Leaderboards - but the error might be visible from your line:

String.valueOf(R.string.leaderboard_id) 

is not giving you the string you specified in the some strings.xml file, but some string containing the internal android id for that String like "1234567". To get the String from the file you should use

getContext().getString(R.string.leaderboard_id)

这篇关于Android - 分数没有被提交给排行榜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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