Firebase .list().push() works once only in android


#1

Hello there,

am trying to push data into firebase after the user picks a location on the map using a marker.
then the location alongside with some other information is pushed using firebase .list().push.
I didn’t want to post the whole code cause it quite long.

that.fb.afdb.list('requests/').push(serviceRequest).then(d=>{
      that.userRequest.destinationLat = null;
      that.userRequest.destinationLng = null;
      that.userRequest.message = null;
      that.userRequest.originLat = null;
      that.userRequest.originLng = null;
      that.userRequest.requestType = null;
      successRequest.present();
      this.navCtrl.popToRoot();

    }).catch(e=>{
      let failedRequest = that.Alert.create({
        title:"Failed",
        subTitle: e.message,
        buttons: ['Dismiss']
      });
      failedRequest.present();
    });

now the thing is this part work perfectly fine in the browser and iOS. but in android, it only works once I install the app, and I have to clear the data of the app - from the settings of the phone -
In addition, .list() does not throw an error, and tried to check if there is a rejection but none was there. its like, this part doesnt excute at all.

information

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:

    Cordova CLI : 7.1.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node  : v6.11.3
    npm   : 3.10.10 
    OS    : macOS High Sierra
    Xcode : Xcode 9.3 Build version 9E145 

#2

As a first step, I would upgrade to the current Node LTS, including npm 5, and then see if the problem still exists.

Edit: also, use AngularFire, much simpler syntax.


#3

Do I need to update the code afterwards?


#4

Maybe. I didn’t bother to parse your code, because your Node setup was a bigger problem, and, frankly, I think you should rewrite the code completely using AF.


#5

I don’t want to risk, and i cant afford to rewrite my code, I have deadline to meet.
regarding the problem, could it be caching problem?