Reputation: 755
I'm using firebase and my problem is when I used setValue
, then I check website, I don't find any changes.
This is my code
firebaseRoot = new Firebase("https://xxxx-xxxxx.firebaseio.com/devices");
Firebase deviceChild = firebaseRoot.child("child");
deviceChild.addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(com.firebase.client.DataSnapshot dataSnapshot)
{
Logger.i(LOG, "onDataChange");
}
@Override
public void onCancelled(FirebaseError firebaseError)
{
Logger.i(LOG, "onCancelled");
}
});
deviceChild.setValue("test", new Firebase.CompletionListener()
{
@Override
public void onComplete(FirebaseError firebaseError, Firebase firebase)
{
Logger.i(LOG, "onComplete");
}
});
In log i keep getting
E/FirebaseCrash: Error sending crash report: IOException while sending a crash report
It does enter the method onDataChange
, does this mean it saved it? if yes, then why i can't see it in website?
Since i'm only testing, this is my rules for Database
{
"rules": {
".read": true,
".write": true
}
}
EDIT I've also tried the following code
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference(url);
myRef.setValue("Hello, World!").addOnCompleteListener(new OnCompleteListener<Void>()
{
@Override
public void onComplete(@NonNull Task<Void> task)
{
Logger.i(LOG, "onComplete");
}
}).addOnFailureListener(new OnFailureListener()
{
@Override
public void onFailure(@NonNull Exception e)
{
Logger.i(LOG, "onCancelled");
}
});
Still doesn't work. can anyone tell me what is wrong?
Upvotes: 1
Views: 2634
Reputation: 755
Okay so the problem was that my tablet date, not sure why, was 2015 and I guess some Internet validation somewhere blocked me. The code is working though.
Upvotes: 1