这很容易实现,而且您不会
要查找Android设备的序列号,请使用以下代码:
TelephonyManager tManager =(TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE); String androidSerialNumber = tManager.getDeviceId();有了这个 androidSerialNumber ,您可以使用它保存在你的数据库中。
0下载表示接受
另一种方法是更改数据库规则:
{rules: {.read:true,。写:auth!= null} }
I am trying to create a Firebase Login and Register App. I have setup that At the time of registration android id will save to the database. If the Android Id exits with another account the user can't create account . when i run the app and try to register an account its shows "Registering Please Wait..." and nothings happens . How can i fix this?
解决方案To solve this problem and all your problems regarding authentication is suggest you using Firebase Authentication.
It's very easy to implement and you'll don't have in the future any code to maintain.
To find serial number of Android device please use this code:
TelephonyManager tManager = (TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE); String androidSerialNumber = tManager.getDeviceId();Having this androidSerialNumber you can use it to save it in your database.
0down voteaccepted
Another approach will be to change The Rule Of Database like this:
{ "rules": { ".read": "true", ".write": "auth != null" } }
更多推荐
Firebase数据库查询不起作用
发布评论