config.xml vs AndroidManifest.xml? - android

In Cordova/Android, what's the difference between:
/appname/config.xml
/appname/platforms/android/AndroidManifest.xml
Which one do I edit, or do I edit them both?
I'm looking to do things such as:
force portrait mode (I found this setting in config.xml)
specify minimum sdk supported for android. (I found this setting in AndroidManifest.xml)

You support to modify at /appname/config.xml
When you add a platform, ionic will regenerate /appname/platforms/android/AndroidManifest.xml file for you to build android app. So, it will collect the permission from your plugin and config.xml to build AndroidManifest.xml

Only update config.xml (not AndroidManifest.xml as it gets generated whenever you do a build)
For example to do portait add in config.xml:
<preference name="orientation" value="portrait" />
And to set minimum sdk add in config.xml:
<platform name="android">
<preference name="android-minSdkVersion" value="19" />
</platform>

Related

cordova-plugin-ionic-webview - custom scheme not working on Android

I am developing (and near to the release) of a Cordova App for iOS and Android.
I am trying to use cordova-plugin-ionic-webview in order to use the latest WebView engines.
I am able to use this plugin on iOS but on Android the App crashes on launch.
MY CONFIG.XML:
<allow-navigation href="cordovaios://*" />
<allow-navigation href="cordovaandroid://*" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<preference name="Hostname" value="my-backend-url-to-avoid-CORS.com" />
<preference name="iosScheme" value="cordovaios" />
<preference name="Scheme" value="cordovaandroid" />
<preference name="ScrollEnabled" value="true" />
<preference name="MixedContentMode" value="0" />
<preference name="AllowBackForwardNavigationGestures" value="true" />
<preference name="Allow3DTouchLinkPreview" value="false" />
<preference name="WKSuspendInBackground" value="false" />
<preference name="KeyboardAppearanceDark" value="false" />
LOGS:
5726-5770/mycertificate.enterprise D/SERVER: Handling local request: cordovaandroid://my-backend-url-to-avoid-CORS.com/static/js/10.601e7973.chunk.js
5726-5773/mycertificate.enterprise E/chromium: [ERROR:render_process_host_impl.cc(4070)] Terminating render process for bad Mojo message: Received bad user message: Origin is invalid
5726-5773/mycertificate.enterprise E/chromium: [ERROR:bad_message.cc(23)] Terminating renderer for bad IPC message, reason 123
NOTE:
This config works fine on iOS. On Android I can't use this plugin due to this Hostname/Origin issue.
That custom scheme does not appear to be supported (just try to find something alike that in the source code). It is also beyond my understanding, for what one even would even need to register a custom protocol handler, while never leaving that WebView? The usual purpose is: to open another application.
<preference name="Scheme" value="https" />
<allow-navigation href="https://my-backend-url-to-avoid-CORS.com/*"/>
Unfortunately there is a lot of mismatching between the Cordova Android Platform version and plugins versions, which lead to some waste of time for nothing. Said so, for similar problemas I had like this I simply fixed them downgrading the version of Cordova or Android or the Plugin (or use the same version of android the plugin is using in their code example).

How do target an API level for android from config.xml for phonegap?

I used to build apps with the basic config.xml file for phonegap for play store until recently when my apps were being rejected because they did not target API level 26. I did some research and and tried a few solutions and did this:
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="26" />
<preference name="android-targetSdkVersion" value="26" />
</platform>
which went from bad to worse, my apps in debug mode (after xompilation on phonegap build) won't even be parsed on android anymore.
I have equally read a couple of solutions but none seems to walk. I really just want to know what I should be including into the config.xml file so that I can going anew.
My config.xml file has these two lines but they are placed outside of
<platform name="android"></platform>
Here are the values that I use and my app is live on both Apple and Google app store:
<preference name="android-targetSdkVersion" value="26" />
<preference name="android-minSdkVersion" value="14" />
Let me know if you want an example of my full config.xml file! :)

Trouble changing android-minSdkLevel on Ionic project

Well...
Once i've set the android-minSdkLevel on my ionic project and this worked, but now this isn't working...
I've set
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="19" />
And when I run ionic platform add android it is always adding android#5.2.2 instead of android#4.4.2(api level 19)...
I've found this at the end of my config.xml <engine name="android" spec="~5.2.2" /> and tried to use spec="~4.4.2" but this didn't work too... Cordova returns me that 4.4.2 is not an available version.

How to avoid overwriting AndroidManifest.xml in Cordova Android application?

I am creating an application using Cordova. In the platforms folder there is an AndroidManifest.xml file where we can specify the version and other things. But whenever I run the app using cordova run android it reinitializes the file and makes it to the previous state as it was before editing and specifying version name.
Does anyone knows how to stop replacing that file while running that command?
Try specifying the sdk versions in your config.xml, as it is the source for generating the AndroidManifest. Your can add the sdk versions in your config.xml like this:
<preference name="android-maxSdkVersion" value="23" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="20" />

Phonegap android add windowSoftInputMode using config.xml

I am creating a phonegap application and for android build I want to set the windowSoftInputMode property of Andriod manifest file using config.xml.
Is there any way to do it using config.xml or command line.Kindly suggest.
Thanks in advance.
Add following preference in your config.xml file :
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />
Also you have to disable the full-screen preference :
<preference name="Fullscreen" value="false" />
Check more :
Android+PhoneGap: android:windowSoftInputMode doesn't seem to work
Cordova Bug

Categories

Resources