Cordova remove: "android.permission.INTERNET" from config.xml - android

My app is a fully offline app with 0 plugins, but on the store, under permissions, it says "full network access."
Is it possible to remove "full network access" using the config.xml.
I have been reading online that in the AndroidManifest.xml this is added by default
<uses-permission android:name="android.permission.INTERNET" />
I am using voltbuilder which is compiles everything online.
This is all that exists in my config.xml:
<engine name="android" spec="11.0.0" />
<preference name="permissions" value="none" />
<preference name="AndroidXEnabled" value="true" />

Related

ERR_PROXY_CONNECTION_FAILED for ajax calls in Cordova based app - Target Android API level 30

I have a Cordova application build for Android, iOS and Windows platforms. As per latest google play store guidelines, I am generating my Cordova Android application by targeting API level 30. When I set API 30 , the rest calls(jquery Ajax calls) in my app are not working and giving ERR_PROXY_CONNECTION_FAILED in the console.
When VPN is off it is giving ERR_TIMEOUT. the same app with working fine in Android 10 and below devices without any issue. Rest Calls are accessible with https and VPN on.
To support Android 11 and Above, I have followed all the required steps to be included in Config.xml file with permissions. I have already added below changes in config file to support Android 11 and above, but facing PROXY_CONNECTION_FAILED error.
Cordova : 11.0.0
Cordova-android:9.1.0
Installed whitelist plugin
Config.xml changes
<access origin="*" subdomains="true"/>
<allow-navigation href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="android-compileSdkVersion" value="30" />
<preference name="android-minSdkVersion" value="22" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</config-file>
</platform>
Also tried with network_security_config.xml file as well but that is also not working.
What else i am missing here. Does any one face same issue or any suggestions to fix this problem appreciated .
Thanks in advance

Android API - Unable to run on devices set lower than target

I have a PhoneGap app which installs good on any version on Android using the APK.
But upon hosting on PlayStore as Internal Test, it doesn't allow it to be installed on device Android 8 or lower.
The error prompted is "The device is not compatible with this version"
On some other device not listed in Playstore, it just says Item Not Found.
I have choose all countries to host the app.
Following is the config file extract
<preference name="android-minSdkVersion" value="23" />
<preference name="android-maxSdkVersion" value="28" />
<preference name="android-targetSdkVersion" value="28" />
Please advice where I should I be looking into - Play store console or my app?
Though not entirely sure where the problem was, but following config does work
<preference name="android-minSdkVersion" value="23" />
<preference name="android-maxSdkVersion" value="29" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="android-build-tool" value="gradle" />
Set above in your config.xml file of your root folder.

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! :)

Sencha Touch + Cordova + Android - How to configure the project url?

i am developing a project which have multiple sub domain. i used Sencha Touch framework and Cordova for android app. In browser project is working fine. i build android apk with signing apk for release mode.
i have a serious problem in server handling in ajax. whenever i try to reach server side using ajax, user session getting destroyed.
And i have doubt in my cordova config.xml settings too.
My questions are :
my project url like *.quiz.co . So How to config my config.xml file and How do i specific that custom url for my project. if i use window.open() or top.location.href or anything its redirect to my custom domain url but my android apk project works based on prodution codes not in apk codes.
when i launch my android apk in my mobile its beginning url is "file:///assets/www.index.html". So How can i run my application based on custom domain like *.quiz.co
When i using redirect to custom domain. Server side User Session getting destroy in each ajax call. So How to maintain user session in ajax call ?
config.xml :
<?xml version='1.0' encoding='utf-8'?>
<name>Master Quiz</name>
<description>
Quiz Application for Android platform.
</description>
<icon src="www/img/icon.png" />
<icon src="www/img/icon.png" platform="android" density="ldpi" />
<icon src="www/img/icon.png" platform="android" density="mdpi" />
<icon src="www/img/icon.png" platform="android" density="hdpi" />
<icon src="www/img/icon.png" platform="android" density="xhdpi" />
<content src="index.html" />
<platform name="android">
<preference name="Fullscreen" value="true" />
</platform>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<!-- Wildcards are allowed for the protocol, as a prefix
to the host, or as a suffix to the path -->
<allow-navigation href="*" />
<!-- Allow all unrecognized URLs to open installed apps
*NOT RECOMMENDED* -->
<allow-intent href="*" />
<!-- Don't block any requests -->
<access origin="http://*" />
</widget>
Android Permissions :
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Which version of Cordova? I ask because a recent release in April now mandates that you use the Cordova whitelist plugin.

Android permissions in Cordova 4.0 config.xml

I used Cordova 4.0 to create a phonegap app (that has worked fine via cli on iOS), but I also want to use build.phonegap.com particularly for Android.
The main issue is that upon installing the APK on Android, the security warning lists all features, when I do not actually need any.
I have read that you can remove all permissions with <preference name="permissions" value="none" />and then selectively add back the ones you want.
However, this is not working; I still get all the permissions requested upon install. I must be missing something, or something has changed. (Did I make a mistake using Cordova instead of Phonegap? That's reasonably easy to correct..)
My config.xml is below:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test" version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap="phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android">
<name>Test</name>
<description>
Test.
</description>
<author email="test#test.com" href="http://test.com">
Test
</author>
<content src="index.html" />
<access origin="*" />
<gap:plugin name="org.apache.cordova.statusbar" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#ffffff" />
<preference name="StatusBarStyle" value="default" />
<preference name="DisallowOverscroll" value="true" />
<preference name="permissions" value="none" />
</widget>
Edit: To remove ambiguity, I want to remove the Android security warnings saying this app needs full access to contacts, camera, internet access, etc. I do not need any of these.
config.xml , is just a bunch of information. It is not executed sequentially. so if you mention you require DisallowOverscroll permission and then mention you dont require any permission, it means ,
<preference name="permissions" value="none" />
will not overWrite
<preference name="DisallowOverscroll" value="true" />
for example:
<preference name="DisallowOverscroll" value="true" />
<preference name="permissions" value="none" />
and
<preference name="DisallowOverscroll" value="true" />
<preference name="permissions" value="none" />
both are same.

Categories

Resources