Home > Blockchain >  ionic cordova app loose network access after update
ionic cordova app loose network access after update

Time:09-17

I just upgrade an existing application from ionic4/Angular8/cordova8 to ionic6/angular14/cordova10.

I get no errors during build.

After upgrading i check apk on a tablet using android 8, everythings is ok (i have network access). But i i test the APK on a Android 9 devices, i can't access the API (no network access).

Oldest release use cordova-plugin-whitelist but i need to remove it for building new app and i read that whitelist is not ok with cordova > 10.x

I verify generated AndroidManifest.xml and it contain <uses-permission android:name="android.permission.INTERNET" />

API use CORS and HTTPS protocol, so it does not seem to be an API problem.

package.json: https://pastebin.com/szdcgP0W

config.xml: https://pastebin.com/rGnVc89U

generated AndroidManifest.xml : https://pastebin.com/fSc5UaqM

I also tried adding again cordova-plugin-whitelist but no effect.

I don't understand why i don't have network access, any ideas?

EDIT 1:

Got two additionnal questions:

  • API called by the app respond on HTTPS protocol on 9025 port. Is this an issue with android? Is there additinnal permissions to authorize non standard port?
  • I change API's certificate to a let'encrypt cert. Is there a possible problem with let'sencrypt certs?

CodePudding user response:

I solve this problem by adding this base configuration to my network-security-config:

<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>
  • Related