Data not posted on firebase database


I am trying to save new data in firebase under a node President. i have already set some rules on that node.

"President":{ "$userId":{ ".write": "auth != null && $userId === auth.uid", ".read": " auth.uid != null" } },

In my app

FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); FirebaseUser mFirebaseUser = mFirebaseAuth.getCurrentUser(); FirebaseDatabase mDatabase = FirebaseDatabase.getInstance(); if(mFirebaseUser == null){ }else{ String mUserId = mFirebaseUser.getUid(); DatabaseReference vRef = mDatabase.getReference(MyFirebaseConstants.DATABASE_President); DatabaseReference newPresidentRef = vRef.child(mUserId).push(); String presidentKey = newPresidentRef.getKey(); President pres = new President()//POJO // other few setters pres.setId(visitorKey); newPresidentRef.setValue(pres).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { MyLogger.d("failed to save "+e.getMessage()); } }).addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { MyLogger.d("succedded"); } }).isSuccessful();

<strong>my President pojo extends RealmObject and implements Parcelable</strong>

However when i go to my firebase console, i can't see any data. onSuccess() is never called and onFailure() is never called.


The issue was that I had restricted background data on my device. therefore data was not posted to firebase.

I haven't yet found a better way to detect background data restriction on android device


  • Data not posted on firebase database
  • Error when instantiate chaincode
  • Android ArrayAdapter notifyDataSetChanged doesn't work
  • Unable to Update Firebase user table with userId
  • Null Pointer Exception on Navigation Header Initialized Variables [duplicate]
  • Why are static methods untestable?
  • Passing firebase data from one activity to another via clickable listview
  • error: cannot find symbol method getDownloadUrl()
  • Why use UID in Firebase? Should I use it
  • Android: getting datas with two ValueEventListener from firebase database (setting adapter before Ar
  • How to redirect multiple types of users to their respective Activities?
  • ExceptionInInitializerError - findLibrary returned null
  • BitmapFactory.decodeStream throwing NetworkOnMainThreadException - Android
  • track.add, MidiEvent, and shortMessage (volume control)
  • AWS Cognito Identity JS: Forget/Remember/Do Not Remember Device
  • I have inserted location using geofire in firebase
  • Typo3 Extbase losing fe_user authentication
  • Android auth firebase error: Local module descriptor class for com.google.firebase.auth not found
  • Renewing a connection to Apache Phoenix (using Kerberos) fails after exactly 10 hours
  • Retrieve Data from Firebase between timestamps
  • .net core get GetUserManager from ApplicationUser out of constructor
  • How to retrieve data from firebase to google map?
  • Firebase always returning all the rows
  • Listen to multiple database references [duplicate]
  • multimap representation in memory
  • c++ select async programming
  • Iterating over the big matrix containing 3000 rows and calculate the correlation
  • Update Marker when Location Change based on Value of Child Firebase Android
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • apache spark aggregate function using min value
  • Sorting a 2D array using the second column C++