不是一个android问题。查询Firebase DatabaseReference的习惯用法是什么?
方法意在查询数据库:
private void db() throws FileNotFoundException, IOException {
FileInputStream serviceAccount = new FileInputStream("serviceAccountKey.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
.setDatabaseUrl(stringURL)
.build();
log.info(options.toString());
FirebaseApp firebaseApp = FirebaseApp.initializeApp(options);
FirebaseDatabase f = FirebaseDatabase.getInstance(firebaseApp, stringURL);
DatabaseReference databaseNonRoot = f.getReference();
DatabaseReference databaseReference = databaseNonRoot.getRoot();
log.info(databaseReference.toString());
// databaseReference.addValueEventListener(new ValueEventListener(){
//really?
}
我已经通过网络接口输入的数据manually。如何查询Firebase?类似SELECT * FROM <TABLE>
是我正在寻找。
JSON数据导出:
{
"abc" : 123,
"bar" : 4342342,
"foo" : 432434
}
还看到:
how to get all child list from Firebase android
通常,与Android和其他Java环境之间的Firebase数据库进行交互是相同的。读取数据列表在这里解释:https://firebase.google.com/docs/database/android/lists-of-data#child-events并在这里:https://firebase.google.com/docs/database/ admin/retrieve-data#section-event-types你的数据结构是什么样的(如JSON文本,请不要截图)?您可以通过点击[Firebase数据库控制台](https://console.firebase.google.com/project/_/database/data)中的“导出JSON”链接来获取此信息。 –
我会用JSON立即更新。如果我能得到JSON树,这将让我朝着正确的方向前进。 – Thufir