我试图更新我的cordova应用程序使用SDK 30而不是29,我有一个问题,我不能解决。
显然,在Android SDK 29和30之间,webview的setAllowAccessFile的默认值从true更改为false。问题是,在我的cordova应用中,我无法访问WebView API,因此需要使用config.xml文件更改此值。但我找不到任何合适的选项。
或者至少,我认为问题来自这里。
应用程序是一个Angular 的应用程序打包的Android与 cordova 10。我曾试图从Android 8.1.0切换到Android 10,以添加新的MANAGE_EXTERNAL_STORAGE权限,和其他一些东西,我很肯定不会工作,但,嗯...但没有改变任何事情。
如果你有任何想法如何做到这一点,或其他地方的问题可能来自,我很乐意接受你的建议。
谢谢你,谢谢你
配置文件:
<?xml version='1.0.0' encoding='utf-8'?>
<widget xmlns:android="http://schemas.android.com/apk/res/android" id="my.package.name" version="1.0.6" xmlns="http://www.w3.org/ns/widgets">
<name>My package name</name>
<description>
</description>
<author email="my.email@email.com" href="https://my.website">
My website
</author>
<content src="index.html"/>
<plugin name="cordova-plugin-whitelist" spec="1"/>
<plugin name="cordova-plugin-wkwebview-engine" spec="https://github.com/driftyco/cordova-plugin-wkwebview-engine.git"/>
<plugin name="cordova-plugin-wkwebview-engine" spec="1.2.1"/>
<plugin name="cordova-plugin-device" spec="~1.1.5"/>
<plugin name="cordova-plugin-statusbar" spec="~2.2.2"/>
<plugin name="cordova-plugin-splashscreen" spec="~4.0.2"/>
<plugin name="cordova-plugin-file" spec="~6.0.0"/>
<plugin name="cordova-plugin-zip" spec="~3.1.0"/>
<plugin name="cordova-plugin-app-version" spec="~0.1.9"/>
<plugin name="cordova-plugin-network-information" spec="~3.0.0"/>
<plugin name="cordova-plugin-save-image" spec="0.2.5"/>
<plugin name="cordova-plugin-customurlscheme" spec="https://github.com/EddyVerbruggen/Custom-URL-scheme.git">
<variable name="URL_SCHEME" value="my.package.name" />
</plugin>
<plugin name="cordova-plugin-intent" spec="https://github.com/napolitano/cordova-plugin-intent.git" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
<preference name="Fullscreen" value="true" />
<preference name="StatusBarOverlaysWebView" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="SplashScreenBackgroundColor" value="white"/>
<preference name="android-minSdkVersion" value="21"/>
<preference name="android-targetSdkVersion" value="30"/>
<preference name="Orientation" value="landscape"/>
<access origin="*"/>
<allow-navigation href="http://localhost:8080/*"/>
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine"/>
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:allowBackup="false"/>
</edit-config>
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:fullBackupContent="false"/>
</edit-config>
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:largeHeap="true" />
</edit-config>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<preference name="AndroidLaunchMode" value="singleTask"/>
<allow-intent href="market:*"/>
<intent-filter>
<action name="android.intent.action.SEND"/>
<action name="android.intent.action.SEND_MULTIPLE"/>
<category name="android.intent.category.DEFAULT"/>
<data mimeType="*/*"/>
</intent-filter>
<intent-filter label="@string/launcher_name">
<action name="android.intent.action.MAIN" />
<category name="android.intent.category.LAUNCHER" />
</intent-filter>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<engine name="ios" spec="~5.1.1"/>
<engine name="android" spec="~10.0.0"/>
</widget>
1条答案
按热度按时间rjee0c151#
我们最近在Cordova应用中处理了Android 11的存储/安全问题。以下是我们发现的一些问题--这可能是也可能不是你的应用中正在发生的事情。更多信息可以在我的回答中找到(如何在PhoneGap将看到的Android目录中获取文档--我试图保持更新):
MANAGE_EXTERNAL_STORAGE
权限。谷歌为需要扫描文件系统的应用程序保留了该权限(我猜是病毒扫描程序等)--其他应用程序将被Play商店拒绝。AndroidManifext.xml
文件中的权限相反)。我目前使用的是cordova.plugins.diagnostic插件,将ANDROIDX_VERSION
标志设置为1.0.0
。以下是相关代码:请注意,还有其他插件可以请求适当的运行时权限/授权。诊断插件是我第一次遇到这个问题时遇到的第一个插件。
希望这能帮上忙。如果你需要比较笔记,我们的应用程序在GitHub上:https://github.com/adapt-it/adapt-it-mobile