我正在开发一个Ionic应用程序,我想通过config.xml在AndroidManifest.xml文件中添加android @ autoBackup =“ false”。根据cordova文档,cordova版本6.4在config.xml中支持edit-config标记,通过它我可以实现类似于plugin.xml的标记。
这就是我在config.xml文件中编写的内容。
<platform name="android">
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:autoBackup="false" />
</edit-config>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>
Run Code Online (Sandbox Code Playgroud)
它会像这样更改我的AndroidManifest.xml文件
<application android:autoBackup="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" 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>
<application android:autoBackup="false" />
<activity android:exported="true" android:launchMode="singleTop" android:name="com.gae.scaffolder.plugin.FCMPluginActivity">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> …Run Code Online (Sandbox Code Playgroud)