How to stop ionic cordova run android command delete existing ionic apps on the device - ionic-framework

I'm new to the forum and need help on running/installing ionic 3 app on a real device.
This command: ionic cordova run android (in my case) will delete the existing ionic app being installed on the device even though the app names are different.
I'd tried using ionic cordova run android --prod --release but the result is the same, i.e. Only ONE ionic app will be installed on the Android device which doesn't sound right.
Is there a way to prevent that from happening? Any options? Below is my package.json file:
"dependencies": {
"#angular/common": "5.0.3",
"#angular/compiler": "5.0.3",
"#angular/compiler-cli": "5.0.3",
"#angular/core": "5.0.3",
"#angular/forms": "5.0.3",
"#angular/http": "5.0.3",
"#angular/platform-browser": "5.0.3",
"#angular/platform-browser-dynamic": "5.0.3",
"#ionic-native/core": "4.4.0",
"#ionic-native/splash-screen": "4.4.0",
"#ionic-native/status-bar": "4.4.0",
"#ionic/pro": "1.0.16",
"#ionic/storage": "2.1.3",
"cordova-android": "6.3.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},

Have you changed the package name of that App? This issue happened when package name of Apps are same.

Related

Ionic 3 google maps link generated in the head

I'm working on an offline app with ionic version 3 but something strange always happens when i run "ionic cordova run android"
In the index.html in head it generates this :
<!-- cordova.js required for cordova apps (remove if not needed) -->
<script src="https://maps.googleapis.com/maps/api/js?key=xxx"></script>
<script src="cordova.js"></script>
I removed all the plugins and modules for gps and maps
this is my package.json file:
"dependencies": {
"#angular/platform-browser": "5.2.11",
"#angular/platform-browser-dynamic": "5.2.11",
"#ionic-native/aes-256": "^4.20.0",
"#ionic-native/android-permissions": "^4.20.0",
"#ionic-native/app-update": "^4.20.0",
"#ionic-native/app-version": "^4.20.0",
"#ionic-native/barcode-scanner": "^4.20.0",
"#ionic-native/bluetooth-serial": "^4.20.0",
"#ionic-native/core": "~4.18.0",
"#ionic-native/device": "^4.20.0",
"#ionic-native/diagnostic": "^4.19.0",
"#ionic/storage": "^2.2.0",
"cordova-android": "8.1.0",
"cordova-plugin-advanced-http": "^2.1.1",
"cordova-plugin-aes256-encryption": "^1.2.2",
"cordova-plugin-android-permissions": "^1.0.0",
"cordova-plugin-app-update": "^2.0.2",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-appversion": "^1.0.0",
"cordova-plugin-bluetooth-serial": "0.4.7",
"cordova-plugin-dbcopy": "^2.1.2",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-email-composer": "^0.9.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.5.1",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-permission": "0.1.0",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-uid": "^1.3.0",
"cordova-plugin-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-toast": "^2.7.2",
"cordova-sqlite-storage": "^3.2.1",
"cordova.plugins.diagnostic": "^4.0.12",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"ts-md5": "^1.2.4",
"zone.js": "0.8.26"
},
I don't need maps anyways so any help would be appreciated !
There is probably still plugins defined in your Cordova config.xml file.
Or alternatively remove the plugins with Cordova command
cordova plugin remove <plugin>
or
cordova plugin rm <plugin>

Ionic native Http post not working in IOS

I need help in resolving this issue. I’m facing issue when doing POST request to get the access token in IOS. Whereas it works fine in Android.
I'm using the Cordova plugin cordova-plugin-advanced-http: "^2.4.1".
Code:
const bodyParams = {‘client_id’:clientId,‘client_secret’:secret,‘grant_type’:‘authorization_code’,‘code’:tokenOrCode};
const httpResponse = await this.http.post(accessTokenUrl, bodyParams, {“Content-Type”: “application/json”});
Error:
{“error”:“invalid_client”,“error_description”:“FBTOAU204E An invalid secret was provided for the client with identifier: ‘abc#abc.com’.”}
Note: The above code works without any issues in Android.
Package.json:
"#angular/common": "^7.2.2",
"#angular/core": "^7.2.2",
"#angular/forms": "^7.2.2",
"#angular/http": "^7.2.2",
"#angular/platform-browser": "^7.2.2",
"#angular/platform-browser-dynamic": "^7.2.2",
"#angular/router": "^7.2.2",
"#ionic-native/core": "^5.0.0",
"#ionic-native/http": "^5.2.0",
"#ionic-native/network": "^5.24.0",
"#ionic-native/secure-storage": "^5.2.0",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^4.1.0",
"ajv": "^6.10.0",
"cordova-ios": "^4.5.5",
"cordova-plugin-advanced-http": "^2.0.9",
"cordova-plugin-cookiemaster": "^1.0.5",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^3.0.0",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-secure-storage": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
Before sending post request set serializer as per your request :
For json :
this.http.setDataSerializer("json");
const bodyParams = {‘client_id’:clientId,‘client_secret’:secret,‘grant_type’:‘authorization_code’,‘code’:tokenOrCode};
const httpResponse = await this.http.post(accessTokenUrl, bodyParams, {“Content-Type”: “application/json”});
I was having a problem similar to your problem like request was working on Android, was not working on Ios. (Ionic 5 - Capacitor App)
I fixed my problem to changing my content-type.
It may help you too, please try it.
{“Content-Type”: “application/json”}
Replace with the following
{“Content-Type”: “application/x-www-form-urlencoded”}

Errors when upgrading to Ionic 3

package.json
"dependencies": {
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#ionic-native/core": "^3.4.2",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.0",
"typescript": "~2.2.1"
},
When I wanna change my version of Ionic from Ionic2 to Ionic3, I encountered some errors Is it my version of #angular/core outdated or? [Sorry I could not copy and paste the errors here, only can snip a photo of it.]

Error While Adding New Provider in ionic

When i try to add a new provider to my existing ionic project it throws
The generate command is only available for projects t
hat use ionic-angular >= 3.0.0
I tried the following command to upgrade but it doesn't worked out
>npm install --save ionic-angular
My Ionic Version is 3.2.0
My Package.json looks
"dependencies": {
"#angular/common": "2.4.8",
"#angular/compiler": "2.4.8",
"#angular/compiler-cli": "2.4.8",
"#angular/core": "2.4.8",
"#angular/forms": "2.4.8",
"#angular/http": "2.4.8",
"#angular/platform-browser": "2.4.8",
"#angular/platform-browser-dynamic": "2.4.8",
"#angular/platform-server": "2.4.8",
"#angular/tsc-wrapped": "~0.5.2",
"#ionic/storage": "2.0.0",
"ionic-angular": "^2.3.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"lodash-es": "^4.17.4",
"node-uuid": "^1.4.7",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"uuid": "^2.0.2",
"zone.js": "0.7.2"
}

create project in ionic with --v2 and framework are 3

I created a project with
ionic start navigationAppv2 blank --v2
but when I use ionic info say:
Ionic Framework Version: 3.0.0
how can I solve this?
Not sure what you mean but I suspect you want to downgrade your Ionic framework version? If so, you just need to update your package.json to "ionic-angular": "2.3.0" for instance. The below is an extract of my package.json file running on the latest v2 version:
"#angular/common": "2.4.8",
"#angular/compiler": "2.4.8",
"#angular/compiler-cli": "2.4.8",
"#angular/core": "2.4.8",
"#angular/forms": "2.4.8",
"#angular/http": "2.4.8",
"#angular/platform-browser": "2.4.8",
"#angular/platform-browser-dynamic": "2.4.8",
"#angular/platform-server": "2.4.8",
"#ionic-native/core": "3.4.4",
"#ionic-native/device": "3.4.4",
"#ionic-native/in-app-browser": "3.4.4",
"#ionic-native/local-notifications": "3.4.4",
"#ionic-native/splash-screen": "3.4.4",
"#ionic-native/status-bar": "3.4.4",
"#ionic/storage": "2.0.0",
"ionic-angular": "2.3.0"