I am trying to access a webpage on my website using webview. This webpage has a Google Maps embedded. When this page is opened from the browser the map is displaying correctly. But when opened from Xamarin Forms Android App (iOS I haven't tried yet) it is showing following error in log:
[chromium] [INFO:CONSOLE(627)] "Permission denied", source: <url of my website page that has the map>
As suggested by other questions on SO I added following network config file:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">mysite.com</domain>
<domain includeSubdomains="true">mysite.co.nz</domain>
<!-- Debug port -->
<domain includeSubdomains="true">google.com</domain>
<domain includeSubdomains="true">googleapis.com</domain>
<domain includeSubdomains="true">maps.googleapis.com</domain>
</domain-config>
</network-security-config>
and added in Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:networkSecurityConfig="@xml/network_security_config" .............
Also, I added permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
Also, I added Xamarin.GooglePlayServices.Maps
package.
But none of the solutions are working. Please help.
CodePudding user response:
where is it shown or requested access permission to use GPS? The user must accept tracking using their GPS. You should always check if the user approves the permission, it's not enough to just add the manifest, because if the user navigates in the app list, he can uncheck this permission and then your app won't work or even crash.