小编Pra*_* ED的帖子

Firebase Firestore订单不工作

我通过官方文档了解Firebase Firestore.我正在尝试使用代码.使用firestore的add()方法添加通知.

FirebaseFirestore.getInstance().colRefNotifications()
            .orderBy("timestamp", Query.Direction.DESCENDING)
            .get()
            .addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
        @Override
        public void onSuccess(QuerySnapshot documentSnapshots) {

            if (!documentSnapshots.isEmpty()){

                listNotifications.clear();
                recyclerViewNotification.removeAllViews();

                for (DocumentSnapshot data : documentSnapshots){

                    Notification notification = data.toObject(Notification.class);
                    listNotifications.add(notification);
                }

                notificationGeneralAdapter.notifyDataSetChanged();
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

Notification.java

private String text;
private String key;
private Date timestamp;

public Notification() {
}

public Notification(String text, String key, Date timestamp) {
    this.text = text;
    this.key = key;
    this.timestamp = timestamp;
}

public String getText() {
    return text;
}

public String getKey() {
    return key;
} …
Run Code Online (Sandbox Code Playgroud)

android firebase google-cloud-firestore

6
推荐指数
1
解决办法
3060
查看次数

两个Android应用和一个Firebase数据库

我需要为两个Android应用使用一个Firebase数据库.一个应用程序将具有对数据库的写入权限,另一个应用程序将具有对数 这两个应用程序必须分开.我无法合并它们.我可以为两个应用使用一个Firebase数据库吗?怎么样?请一步一步指导.我是Firebase的新手.

android firebase android-studio firebase-realtime-database

1
推荐指数
1
解决办法
777
查看次数