Search This Blog

Friday, March 18, 2016

FIREBASE TONG QUAN

Firebase.setAndroidContext(this);

myFirebaseRef = new Firebase("https://sweltering-torch-6326.firebaseio.com/");


// them du lieu len FireBase 

myFirebaseRef.child("ThemCapCon1").setValue("Le Minh Nhut");
 
// them mot cap con có nhiều thuộc tính 
FireBase add = new FireBase("Le Minh Nhut", 22);

myFirebaseRef.child("ThemCapCon1").setValue(add);
 
// thêm một cấp con bằng Map .
 
Map<String , Integer> map = new HashMap<String,Integer>();

map.put("Tuoi",1994);

myFirebaseRef.child("ThemCapCon2").setValue(map);
 
// thêm một Object .
 
FireBase addObject1  = new FireBase("Lap Trinh Android", 2000000);

myFirebaseRef.child("ThemConObject").push().setValue(addObject1);

FireBase addObject2  = new FireBase("Lap Trinh Ios", 5000000);

myFirebaseRef.child("ThemConObject").push().setValue(addObject2);
 
// Sự kiện sau khi up lên database hoàn tất 

 

No comments:

Post a Comment