Firebase 纯 Java 客户端 [英] Firebase Plain Java Client

本文介绍了Firebase 纯 Java 客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 Firebase 与 Java 桌面应用程序集成?

How can I integrate Firebase with a Java desktop application?

有可以下载的 .jar 文件吗?

Is there a .jar file I could download?

我看过有关旧版 Firebase 的纯 Java 文档,但找不到有关最新版 Firebase 的任何文档.

I've seen plain Java docs on the old Firebase version but I'm unable to find any documentation on the latest version of Firebase.

我的 IDE 是 Netbeans.

My IDE is Netbeans.

谢谢.

推荐答案

可以使用firebase-server-sdk-3.0.1.jar(当前版本)

You can use firebase-server-sdk-3.0.1.jar (current version)

在 Netbeans 中,我建议创建 Maven 项目并使用工件:GroupId - com.google.firebase,ArtifactId:firebase-server-sdk.

In Netbeans I would recommend to create Maven project and use artifact: GroupId - com.google.firebase, ArtifactId: firebase-server-sdk.

我非常适合我.您可以在此处找到一些文档.

I works perfectly for me. You can find some documentation here.

要初始化 SDK 只需按照文档:添加服务帐户(我使用所有者角色,我没有尝试过弱角色),下载私钥,并使用以下代码段:

To initialize SDK just follow documentation: add service account (I use Owner role, I haven't tried weaker roles), download private key, and use this snippet:

FirebaseOptions options = new FirebaseOptions.Builder()
  .setServiceAccount(new FileInputStream("path/to/downloaded private key.json"))
  .setDatabaseUrl("https://your database name.firebaseio.com/")
  .build();
FirebaseApp.initializeApp(options);

这篇关于Firebase 纯 Java 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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