Download async data in phones (Solved)

Hi everone,

I’m trying to download a list of data from Firebase into my Ionic app, the idea is to trigger the download on the intro sliders, so while the user checks out how the app works I download the data and save it to localStorage.

I’m calling this function:

getCollegeList(): any {
  let loadCollege = [];
  return this.fireCollege.once('value').then( collegeList => {
    console.log("Inside the .then() for the firebase call");
    collegeList.forEach( college => {
        id: college.key,
        name: college.val().name,
    this.local.set('collegeList', JSON.stringify(loadCollege));

And everything is working fine when I test on my browser, I’m being able to swipe through the slides and when I’m on slide ~ #4 the data gets saved to localStorage and I never notice and lay or anything like that because I’m doing an async call.

But when I try it on my phone it’s not working like that, I’m opening the app and it freezes on the first slide, it doesn’t let me do anything until about ~15 seconds that it finishes downloading the app.

So I’m sensing the call is being made on android’s main thread, so it’s blocking me until the .then() part of my function is ready.

How can I fix this? How can I make it so the function is called async on the mobile devices?

Thanks a lot for reading this far :stuck_out_tongue:

EDIT: Yeah, the list was too big, so instead we cut a lot of stuff to make it work