如何将Admin SDK API添加到Android项目 [英] How to add Admin SDK api to android project

查看:141
本文介绍了如何将Admin SDK API添加到Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用需要具有管理员和常规用户的Android应用程序.为了说明这一点,管理员可以管理普通用户,如delete,修改其内容.根据我的研究,firebase提供的Admin SDK API确实可以解决此问题,但根据他们的文档,Admin SDK不能在Android项目本身中使用,而应放置在项目的服务器端.另外,我尝试将Admin SDK依赖项添加到我的项目依赖项中,但是库之间存在冲突.我知道我所做的将Admin SDK添加到Bulid.gradle(应用程序)是错误的,但是我没有设法弄清楚如何将Admin SDK添加到我的项目中.

I am currently working in an Android application that requires to have Admin and regular users. To illustrate, the admin has the ability to manage the regular users like delete , modify their contents. According to my reserch that firebase provide Admin SDK API that can be realy sutiable for this issue but according to thier documention that Admin SDK cannot be used in the Android project itself and should be placed in the server-side of the project. In addition, i was tried to add the Admin SDK debendence to my project dependences but there is conflict between the libraries . I know what i was did is wrong to add the Admin SDK to the Bulid.gradle (app) but i did not manage to figure out how i can add the Admin SDK to my project.

推荐答案

所找到的是正确的.您的案例似乎适合使用Firebase Admin SDK.

What you've found is correct. Your case seems to be suitable for using Firebase Admin SDK.

Firebase Admin SDK需要一个服务器应用程序,它将在其上进行初始化.

Firebase Admin SDK needs a server app, on which it will be initialized.

此处,您可以找到设置Firebase的前提条件的完整列表Android SDK.

Here you can find a full list of the prerequisites for setting-up Firebase Android SDK.

您可以设置Firebase功能,该功能将保存您的服务器端代码.在这些功能中,您还可以初始化Firebase Admin SDK.

You can set-up Firebase Functions, which will hold your server-side code. Inside those functions you can also initialize the Firebase Admin SDK.

此处有关Firebase函数的更多信息.

Please refer here for more information on Firebase Functions.

在这里,您可以找到一个使用Admin SDK的示例Firebase应用程序.该示例显示了如何验证对JSON API的访问,以仅允许特定Firebase用户访问数据.

Here you can find a sample Firebase application which uses the Admin SDK. The sample shows how to authenticate access to a JSON API to only allow access to data for a specific Firebase user.

Firebase函数的构建是为了充当无服务器代码,当您开发服务器端逻辑,然后将其部署到Google云上的托管环境中时.这些功能可以包含您希望使用Admin SDK拥有的所有逻辑.

Firebase Functions are built to serve as serverless code, as you develop your server-side logic, then deploy it to a managed environment on Google's cloud. Those functions can contain all the logic that you would like to have using Admin SDK.

这篇关于如何将Admin SDK API添加到Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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