无法从Firebase

时间:2016-04-11 12:59:11

标签: android firebase firebase-realtime-database

这是来自firebase数据库的我的JSON:

{
  "57c80ec0-e73f-49df-8296-25999e194288" : {
    "email" : "ss@zz.mm",
    "hotel" : {
      "-KEaYE1YfvPTRfgcO6Z_" : {
        "latit" : 20.15135303358223,
        "longit" : 23.86566750705242,
        "name" : "Westin",
        "rating" : 1,
        "review" : "hehehe hehehe hehehe hehehe hehehe hehehe hehehe"
      },
      "-KEaYGDhbFAN99GyY0cH" : {
        "latit" : 30.211601559876424,
        "longit" : -4.754576571285725,
        "name" : "Sheraton",
        "rating" : 5,
        "review" : "hohoho hohoho hohoho hohoho hohoho hohoho hohoho hohoho     hohoho hohoho"
      },
      "-KEbjCjmx4-Xmr_1aVCy" : {
        "latit" : 20.58906906737089,
        "longit" : 25.271570831537247,
        "name" : "Admiral",
        "rating" : 3,
        "review" : "hahaha hahaha hahaha hahaha hahaha hahaha hahaha hahaha     hahaha hahaha hahaha hahaha"
      }
    },
    "password" : "nn",
    "username" : "ss"
  },
  "c01528ea-a22c-43de-b77a-bc833c5e394c" : {
    "email" : "ses@ses.ses",
    "hotel" : {
      "-KEaLImMODDRiDwK3gSo" : {
        "latit" : 18.160196227874213,
        "longit" : 26.094263345003128,
        "name" : "Osijek",
        "rating" : 2,
        "review" : "lalala lalala lalala lalala lalala alalal lalala lalala     lalala lalalal"
      },
      "-KEaLKSEg1psa4xvggse" : {
        "latit" : 31.71881281252363,
        "longit" : -2.9933271557092667,
        "name" : "Slavonija",
        "rating" : 4,
        "review" : "aaaa aaaa aaaa aaaa aaaa aaaaa aaaaa aaaa aaaa aaaaa     aaaa aaaaaa aaaaa aa"
      }
    },
    "password" : "ses",
    "username" : "ses"
  }
}


@Override
    public Map<String, Object> rateHotel(String name, double lat, double lon) {
        Map<String, Object> hotel = new HashMap<>();
        hotel.put("name", name);
        hotel.put("latit", lat);
        hotel.put("longit", lon);
        return hotel;
    }

    @Override
    public void addHotel(String name, double lat, double lon) {
        String uid = firebase.getAuth().getUid();
        final Firebase hotelsRef = new Firebase("https://josip-my-application.firebaseio.com/Users/" + uid + "/hotel/");
        hotelsRef.push().setValue(rateHotel(name, lat, lon));
        presenter.onSuccess(name, lat, lon);
    }

这就是我在数据库中推送酒店的方式。我登录后登录了用户的酒店列表。当我点击列表中的一家酒店时,我是一个新的活动,我想要编辑某个酒店的某些字段。

我应该如何查找,或者我应该使用哪个firebase网址来访问某个酒店密钥?

这就是我用来推动新酒店进入火堆的网址......它将新酒店带入酒店&#34;酒店&#34;现场并为每个新酒店生成钥匙。我怎样才能拿到那把钥匙?

Firebase userRef = new Firebase("https://josip-my-application.firebaseio.com/Users/");
String uid = stringObjectMap.get("uid").toString();
userRef = new Firebase("https://josip-my-application.firebaseio.com/Users/" + uid + "/hotel/);

0 个答案:

没有答案