Because I do not synchronize the firebase data

0

I have a problem and the data is not synchronized, the file compiles, followed this tutorial link and compiles correctly but I do not change the data, since android I got it.

I followed this tutorial link

Any ideas?

    FileInputStream serviceAccount = new FileInputStream("keyok.json");

FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://name.com/")
.build();

   FirebaseApp.initializeApp(options);


DatabaseReference ref = FirebaseDatabase.getInstance().getReference();

DatabaseReference usersRef = ref.child("users");

Map<String, User> users = new HashMap<>();
users.put("alanisawesome", new User("June 23, 1912", "Alan Turing"));
users.put("gracehop", new User("December 9, 1906", "Grace Hopper"));

usersRef.setValueAsync(users);
    
asked by Miguel Angel Galaz 12.11.2018 в 10:52
source

1 answer

0

Use the following to update the data

usersRef.updateChildren(users);
    
answered by 12.11.2018 в 20:05