In Firebase addOnSuccessListener
method will be called when the app in online mode. But it is not called when offline mode. Following is my code:
mFirebaseDatabase.setValue(newAreaModel)
.addOnSuccessListener(new OnSuccessListener<Void>()
{
@Override
public void onSuccess(Void aVoid)
{
finish();
}
})
.addOnFailureListener(new OnFailureListener()
{
@Override
public void onFailure(@NonNull Exception e)
{
Toast.makeText(getApplicationContext(), "Something went Wrong!", Toast.LENGTH_SHORT).show();
}
});
Now I want to finish the activity when setValue()
method called in offline mode.
Can anyone suggest me how to do that?