I published a Blazor server application in a web hosting space and then I created a xamarin android with the following lines top open the Blazor application
<StackLayout>
<WebView HeightRequest="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://example.com" />
</StackLayout>
and everything is working fine
If I publish the same Blazor application in another web hosting space that doesn't have a certificate, if I change the Source of the WebView to http://example2.com I see only o totally blank page on the mobile phone.
So it seems to be that the WebView doesn't work with http ?
How can I solve the problem ?
Thanks
Best
| <application android:usesCleartextTraffic="true"> </application> |
Thanks for his reply but at the moment, none of the solution work
This is my manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.shipscolorsapp" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:label="ShipsColorsApp.Android" android:theme="@style/MainTheme" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config">
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
and this is the content of network_security_config.xml file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">www.example.com</domain>
</domain-config>
</network-security-config>
This file is correctly processed because if I change " www.example.com" with another that doesn't exists I receive the error page not found in the simulator, and if I type www.example.com in a browser the web page is correctly showed.
The Android simulator instead shows always a blank page
If I change www.example.com in the webview with an https address the simulator shows the page correctly
<WebView HeightRequest="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://example2.com" />
What else can I try ?