Slow requests after the app has been resumed


Have some know issue related to this?
When I open the app at first time, the requests is extremely fast, but if I leave the app in stand by for some seconds (~30 sec) and resume it, the requests take a lot of time to complete and sometime it can’t be resolved.

Some idea why this happen?

Thank you

Edit 1:
Actually, the slowness occur on page navigation and not on external requests. I need to navigate between pages 4~5 times to get the app running normally. The first time that I change page(after resume app) the loading take 30~40 sec to complete and this time is goes down until it normalizes.

What do you mean by “requests”? External requests? Loading of pages?

Did you remote debug the problem on the device already?
Follow these instructions here to debug the problem in Safari dev tools:
Follow these instructions here to debug the problem in Chrome dev tools:
Look at the console and network tabs for errors.

After debug I discover that the problem is on loading pages. Some external request is a bit slow too (~300ms) but page loading taking 30~40 secs to complete.

Someone have an idea why this happen?

I don’t understand what you are trying to say here.

Ok, let me try to explain…
When I pause the app and leave it inactive for 15 minutes for example, and after try to resume, the app opens in the same page I was, ok… But, if I navigate to another page, the time to load is about 30~40 seconds to complete. External request doesn’t have any impact about this time.

Sorry if I can’t explain clearly

I think I got it now: After you resume your app, navigating to a different page in your app is very slow. Correct?

How do you navigate to pages in your code?
Anything special about these pages?
Can you replicate the problem with a new project created with e.g. ionic start test tabs?
What is your ionic info output?

I can’t reproduce on new project.

After some tests, I think the only way is to reload the app when user resumes it.
How can I force app to reload?

I’ll implement a function that verify the time that user app is paused and when the app is resumed, checks if the paused time is bigger than 10 minutes, for then to call reload function.

That seems like a premature conclusion.

If you really want to implement something like that, please create a new topic and ask there.

But I really suggest you find out why this is happening. It is definitely not normal.
(First step would be to answer the questions from my previous post)

You’re right, maybe we can find a better solution.

At this way:
Sometimes I send params

this.navCtrl.push(newPage, {
    someParam: someVal

All pages makes external requests every time they are called, and I setup to make requests on ionViewWillEnter()
I have a loop that run each 4 seconds to update certain info that I need to keep up to date. I tried to pause this loop when app is paused and resume it when app is resumed, but this doesn’t solve my problem. The loop is called on app.component.

Unfortunately(or not) I can’t

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.0.0
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.2.3 ios 4.2.0
    Ionic Framework                 : ionic-angular 2.0.0


    Node       : v7.10.0
    OS         : OS X El Capitan
    Xcode      : Xcode 7.3.1 Build version 7D1014 
    ios-deploy : 1.9.1 
    ios-sim    : not installed
    npm        : 4.2.0 

These sound like likely culprits for your problems. Please post examples what you are doing in there.

I removed the loop to test and the problem is still happen.

This is an example of a request to update a list:

listRating() {

    let headers = new Headers();

    this.cookie.getCookies(['cookie1', 'cookie2', 'cookie3'])
    .then((val) => {
        this.createAuthorizationHeader(headers, val['cookie1'], val['cookie2'], val['cookie3']);
    .then(() => {
        this.http.get(this.urlListRating +, { headers: headers })
        .subscribe(res => {
            if (res['_body']) {
                var obj = JSON.parse(res['_body']);
                if ( obj.code == 200 ) {

                    this.totalRating = obj.total_rating;
                    this.dataRating = obj.rating_list;

                } else {
            } else {
        }, error => {

When I tried to debug on Chrome, I can saw that when I resume the app te request isn’t called instantly. It take a long time(25~30 secs) to be called

What is calling listRating() and where and how?

So it takes long for

to be called, correct?
Did you add console.log before getCookies to check when this is executed? Does this function take long?

It’s called on ionViewWillEnter()

I’m testing getCookies time…

I would sprinkle console.log everywhere and see what steps actually takes the time. Then see why.