Hey guys, I am using InAppBrowser, my ionic version is 5.4.16. I tried almost everything I found for this topic, unfortunately, I’m still getting this error for links inside my apps with HTTP.
HTTPS works fine. It works fine in Android 8 too, but Android 9 gives this infamous error net::ERR CLEARTEXT_NOT_PERMITTED
Unfortunately, I’m redirecting inside InAppBrowser to external websites of governments nad institutions, which I’m (obviouslyú not owner, I really cannot do anything to change http protocol. I understand security efforts of Google, but I still find it quite annoying.
If anyone knows, what I should do more or if I’m doing something wrong, please tell me. I would be really gratefull and you would be my savior because I just cannot release my app without this !
This is my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Varovný systém ČR</name>
<description>XXXX</description>
<author email="xxxx@outlook.com" href="">XXXX</author>
<content src="index.html" />
<access origin="*" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
......
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">herokuapp.com</domain>
<domain includeSubdomains="true">XY.174.XYY.76</domain>
<domain includeSubdomains="true">dsd.ddd.cz</domain>
<domain includeSubdomains="true">XX.80.ZZZ.19</domain>
<domain includeSubdomains="true">xxx.yyyy.cz</domain>
<domain includeSubdomains="true">http://xxx.yyy.cz</domain>
<domain includeSubdomains="true">XX.80.ZZZ.194</domain>
<domain includeSubdomains="true">xycd.cz</domain>
<domain includeSubdomains="true">http://xycd.cz</domain>
<domain includeSubdomains="true">CC.0.239.195</domain>
</domain-config>
</network-security-config>
<platform name="android">
<access origin="*" />
<preference name="android-usesClearTextTraffic" value="true" />
<editconfig file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
.....
platforms/android/app/src/main/AndroidManifest.xml:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true" tools:targetApi="28">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In resources/android/xml I have:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-archors>
<certificates src="system"/>
</trust-archors>
</base-config>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">herokuapp.com</domain>
<domain includeSubdomains="true">XY.174.XYY.76</domain>
<domain includeSubdomains="true">dsd.ddd.cz</domain>
<domain includeSubdomains="true">XX.80.ZZZ.19</domain>
<domain includeSubdomains="true">xxx.yyyy.cz</domain>
<domain includeSubdomains="true">http://xxx.yyy.cz</domain>
<domain includeSubdomains="true">XX.80.ZZZ.194</domain>
<domain includeSubdomains="true">xycd.cz</domain>
<domain includeSubdomains="true">http://xycd.cz</domain>
<domain includeSubdomains="true">CC.0.239.195</domain>
</domain-config>
</network-security-config>
Thanks guys again for help!