Android - 分数没有被提交给排行榜 [英] Android - score not being submitted to a leaderboard
问题描述
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屋!