Firebase普通Java客户端 [英] Firebase Plain Java Client

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

问题描述

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



是否有可以下载的.jar文件?



Firebase版本,但我无法在最新版本的Firebase上找到任何文档。



我的IDE是Netbeans。

谢谢。


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



我完全适合我。
您可以在此处找到一些文档。



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

  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);


How can I integrate Firebase with a Java desktop application?

Is there a .jar file I could download?

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.

My IDE is Netbeans.

Thanks.

解决方案

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

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.

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天全站免登陆