问题描述
有没有一种方法可以将数据从Firebase中检索到Java应用程序?我有一个Android应用程序,它将数据存储到Firebase数据库中,我需要读取Java应用程序中的数据。我搜索了互联网,但我还没有找到明确的答案。
//不是来自浏览器的URL,是数据库之上的$ <$ p
$ b
FirebaseOptions options = new FirebaseOptions.Builder()
.setDatabaseUrl(https://database-ff395.firebaseio.com/)
.setServiceAccount(new
FileInputStream(C:/Users/Denisa/Desktop/database-2aab74679b79.json))
.build();
FirebaseApp.initializeApp(options);
DatabaseReference ref = FirebaseDatabase
.getInstance()
.getReference(restricted_access / secret_document);
//这里我尝试引用数据库并在其中添加一个值
最终FirebaseDatabase数据库= FirebaseDatabase.getInstance();
DatabaseReference ref1 = database.getReferenceFromUrl(https://database-ff395.firebaseio.com/database-ff395);
ref1.setValue(ooo);
访问Firebase数据库)Firebase文档将JVM视为服务器平台。您可以在中找到所有相关信息。
Is there a way to retrieve data from Firebase to a Java application ?
I have an Android application which stores the data in to a Firebase database and I need to read that data in a Java application. I searched over the Internet, but I have not found a clear answer.
//not the URL from browser, the one above the database
FirebaseOptions options = new FirebaseOptions.Builder()
.setDatabaseUrl("https://database-ff395.firebaseio.com/")
.setServiceAccount(new
FileInputStream("C:/Users/Denisa/Desktop/database-2aab74679b79.json"))
.build();
FirebaseApp.initializeApp(options);
DatabaseReference ref = FirebaseDatabase
.getInstance()
.getReference("restricted_access/secret_document");
//here I try to reference the database and put a value in it
final FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference ref1 = database.getReferenceFromUrl("https://database-ff395.firebaseio.com/database-ff395");
ref1.setValue("ooo");
Accessing the Firebase Database from a regular (non-Android) JVM is considered a server platform by the Firebase documentation. You can find all about it in the Firebase documentation for its server SDKs.
这篇关于如何在(非Android)Java应用程序中检索Firebase数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!