简体   繁体   中英

Ionic 6 Capacitor: add permissions to AndroidManifest.xml on build

With Ionic Cordova, it was possible to use the config.xml file in the project to add specific permissions to the AndroidManifest.xml file during build. That way, when the Android platform folder was removed, the permissions were added to the manifest file each time when rebuilding the app.

Now I am migrating to Capacitor and looking for a similar solution. The Capacitor documentation is however very vague, and mentions direct editing of the AndroidManifest.xml. Now I already ran twice into a situation where I had to remove the Android folder, so the permission edits were lost as well.

Does anyone know how and where to configure the permissions for Ionic Capacitor, so compiling the app will also set the permissions back to the manifest file?

you can try this plugin https://github.com/ionic-team/trapeze :

Trapeze makes it easy to automate the configuration of native mobile iOS and Android projects, and supports traditional native, Ionic, Capacitor, React Native, Flutter, and .NET MAUI.

Trapeze works by automating the modification of pbxproj, plist, XML, Gradle, JSON, resource, properties, and other files in iOS and Android app projects. It features a configuration-driven tool that takes a YAML file with iOS and Android project modifications and performs those modifications from the command line interactively. A Project API is also available for writing custom JavaScript/TypeScript project modification scripts for full control. The configuration tool uses this API under the hood.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM