google-services.json如何替换default_web_client_id? [英] How does google-services.json replace default_web_client_id?

查看:443
本文介绍了google-services.json如何替换default_web_client_id?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我只想说我有Google Play登录并开始工作。然而,我一直在努力了解特定的代码行是如何工作的。

  GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) 
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();

我想知道requestIdToken如何获得我的真实clientId。调查:default_web_client_id = 0x7f060035



当我登录R.string.default_web_client_id时,我得到: 2131099701 <当我登录getString(R.string.default_web_client_id)时,我得到:
xxxxxxx-xxxxxxxxx0tfctc0fa0a.apps.googleusercontent.com(我的网站客户端ID)



此ID不在我的字符串或资源文件夹中。但是它在我的google-services.json文件中。



我的问题是getString或default_web_client_id如何解析为Json文件中的clientID?



感谢您的启发! 解决方案

根据这个你应用gradle插件,然后用JSON的值生成新的xml文件。


First i'd just like to say I have Google play sign in up and working. However I have struggling to understand how a specific line of code works.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

I would like to know how requestIdToken is getting my real clientId.
when investigating: default_web_client_id = 0x7f060035

when i log R.string.default_web_client_id i get: 2131099701

when I log getString(R.string.default_web_client_id) i get: xxxxxxx-xxxxxxxxx0tfctc0fa0a.apps.googleusercontent.com(my web client id)

This id is not located in my strings or resources folder. However it is in my google-services.json file.

My question is how is getString or that default_web_client_id resolving into a clientID in a Json File?

Thanks in advance for the enlightenment!

解决方案

According to this you apply gradle plugin which then generates new xml file with values from the JSON

这篇关于google-services.json如何替换default_web_client_id?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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