I have a strange issue with Ionic mobile application only on the Android version. I have several HTTP requests that I call external APIs and get some data. While I am on Ionic Serve, Ionic Lab or iOS mobile app, I don't have any issue. However, on the Android version, it doesn't update the data of the HTTP requests, but only after 2-3 days.
If I uninstall the app and install it again, it gets the latest data.
This is the HTML:
<ion-item [ngClass]="{'hidden' : (item['status'] == 'trash')}"
item-bcg
*ngFor="let item of cars; let i = index;"
(click)="onClick($event, item)">
...do my stuff...
</ion-item>
This is my component:
getCars() {
return this.wpApi.getCars(this.category, this.maxResults)
.subscribe( (res) => {
this.cars = res['entries'];
this.labels = res['_labels'];
})
}
And this is my service:
getCars = function (category, maxResults) {
let url = this.domain + "/wp-json/gf/v2/forms/1/entries?_labels=1&paging[page_size]=" + maxResults;
let headers: Headers = new Headers();
headers.append("Authorization", "Basic " + this.bt);
headers.append("Content-type", "application/json");
return this.http.get(url, {
headers: headers
})
.map(response => response.json())
};
I call the getCars()
every time the view is opened and also I have a pull to refresh feature that manually calls it when you pull the screen from top to bottom.
This doesn't happen anywhere else. Just on the published Android app on the market.
"@angular/common": "4.1.3",
"@ionic-native/core": "3.12.1"