在哪里可以在Android项目中编写或编辑firebase admin sdk代码? [英] where i can write or edit the firebase admin sdk code in my android project?
问题描述
我是android开发的新手,并且我在android studio中有一个使用firebase的android项目,我正在按照admin sdk"将Firebase Admin SDK添加到您的服务器"中的文档进行控制用户在我的android应用程序中的角色,但实际上我不理解文档,我的问题是我可以在Android项目中编写或编辑firebase admin sdk代码(如下所示)?
I am new in android development and I have an android project in android studio that use firebase and I am following the documentation of admin sdk "Add the Firebase Admin SDK to Your Server" to control the roles of users in my android application, but really I don't understand the documentation, my question is where i can write or edit the firebase admin sdk code (that illustrated below) in my android project ?
这是教程中的代码段
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.getApplicationDefault())
.setDatabaseUrl("https://<DATABASE_NAME>.firebaseio.com/")
.build();
FirebaseApp.initializeApp(options);
推荐答案
Firebase Admin SDK应该在服务器端而非客户端上安装和使用(Android应用).即使您愿意也不能使用它.
Firebase Admin SDK is supposed to be installed and used on a Server-side and not on Client side (Android app). You can't use it even if you want to.
(阅读-适用于Android的Firebase Admin SDK,未找到方法)
因此,您必须在服务器上安装Admin SDK,并在其中编写逻辑,然后从Android应用向服务器发出请求,以获取所需的结果.
So you have to install the Admin SDK on a Server and write your logic there and make requests to the server from your Android app to get the results you want.
希望有帮助
这篇关于在哪里可以在Android项目中编写或编辑firebase admin sdk代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!