简体   繁体   中英

How can I change the AndroidManifest.xml file in Meteor?

I need to add a couple activities to my Meteor Cordova Project, namely:

android:windowSoftInputMode="adjustPan"
and
android:configChanges="orientation|keyboardHidden"

App.setPreference doesn't seem to work for Activities in mobile-config.js and App.setActivity doesn't seem to exist.
Docs on mobile-config.js are available here .

Is there any way to do this currently?

I am quite sure that what you need to do is specified here . Basically what you need to do is

  1. Create a file config.xml under folder cordova-build-override/ in your project.

  2. Copy the basic config.xml generated by creating a new Cordova project.

  3. Add

to your config.xml this:

<application
    android:windowSoftInputMode="adjustPan"
    android:configChanges="orientation|keyboardHidden" />
  1. Make sure you have this

in your widget tag for android to be available:

xmlns:android="http://schemas.android.com/apk/res/android"
  1. Use still the App.setPreference etc to set the normal details.

And yes, I know it is quite hacky, but it makes sense as Meteor uses Cordova internally and has only those "normal" config.xml options are configurable.

The AndroidManifest.xml file can be edited directly and it doesn't seem to get deleted on build.

The file is located in:
.meteor/local/cordova-build/platforms/android

From there the activities can be added directly to the main activity.

I'm still trying to figure out a way to get it to work when pushed to a different server, as the .meteor folder isn't included.

I believe the current (as of 2020) solution to this problem is with a mobile-config.js file in the root of your app directory. see meteor docs https://docs.meteor.com/api/mobile-config.html

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