On first call (when installed) or when I clear data of the app on Android devices, then the http request not works, returning unknown error. So, when I remove de app from memory (not from device) and call again the app, the http request works fine.
The http request is in app.component.ts:
this.httpProvider.getUsuario().subscribe(data => { . . . }, err => { . . . })
"getUsuario" is a function:
getUsuario(tipo, valor) {
return this.http.get(url);
}
I am using HttpClient:
import { HttpClient } from '@angular/common/http';
Can anyone help me, please??
Ionic 3
IONIC INFO:
Ionic:
ionic (Ionic CLI) : 4.8.0 (/usr/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.2
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 12 other plugins)
System:
Android SDK Tools : 26.1.1 (/home/daniel/Android/Sdk)
NodeJS : v10.16.0 (/usr/bin/node)
npm : 6.9.0
OS : Linux 5.1
PACKAGE.JSON (some lines):
"dependencies": {
"@angular/animations": "5.2.9",
"@angular/common": "5.2.9",
"@angular/compiler": "5.2.9",
"@angular/compiler-cli": "5.2.9",
"@angular/core": "5.2.9",
"@angular/forms": "5.2.9",
"@angular/http": "5.2.9",
"@angular/platform-browser": "5.2.9",
"@angular/platform-browser-dynamic": "5.2.9",
"@ionic-native/app-version": "4.10.0",
"@ionic-native/camera": "4.10.0",
"@ionic-native/core": "^4.20.0",
"@ionic-native/diagnostic": "^3.14.0",
"@ionic-native/geolocation": "4.10.0",
"@ionic-native/google-maps": "^4.21.0",
"@ionic-native/network": "^4.20.0",
"@ionic-native/push": "^4.20.0",
"@ionic-native/splash-screen": "4.6.0",
"@ionic-native/status-bar": "^4.20.0",
"@ionic-native/unique-device-id": "^4.20.0",
"@ionic/pro": "1.0.20",
"@ionic/storage": "2.1.3",
"cordova-android": "7.1.4",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-googlemaps": "^2.6.2",
"cordova-plugin-ionic": "^4.2.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-support-google-services": "^1.1.0",
"crypto-js": "^3.1.9-1",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"phonegap-plugin-multidex": "^1.0.0",
"phonegap-plugin-push": "^2.2.3",
"rxjs": "^5.5.12",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.2",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-camera": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-googlemaps": { REMOVED API },
"cordova-plugin-geolocation": {},
"cordova-plugin-uniquedeviceid": {},
"cordova-plugin-network-information": {},
"cordova-plugin-app-version": {},
"phonegap-plugin-push": {},
"cordova-plugin-ionic-webview": {}
},
"platforms": [
"android"
]
}