ionic-team/trapeze

Adding permissions using yml file

marioshtika opened this issue ยท 11 comments

Hello everyone,

I am trying to add some permissions on the AndroidManifest.xml file using a yml file.

I am adding the below lines on my yml file

  android:
    manifest:
      - file: AndroidManifest.xml
        target: manifest/application
        inject: |
          <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
          <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
          <uses-feature android:name="android.hardware.location.gps" />

and when I run the yml file it only enters the first one.

Am I doing something wrong?
Does the inject accept only one xml tag?
Is there another way to add permissions?

Thank you in advance

@marioshtika had this problem too and solved it this way:

- file: AndroidManifest.xml
   target: manifest
   inject: |
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

- file: AndroidManifest.xml
   target: manifest
   inject: |
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

- file: AndroidManifest.xml
   target: manifest
   inject: |
       <uses-feature android:name="android.hardware.location.gps" />

Surely it's not the nicest and cleanest way, but it works for me.

Thank you @lucafulgenzi this is how I also solved it.

But I was wandering if this is the solution or a workaround?
Or is there another way to add permissions?

I think that's not the solution, as it would be inelegant to maybe have 15 different permissions and add them that way. I think that the problem will be solved soon because the project is still 'new' and it is not a too invasive issue.

Good point, this should work. Will take a look as I'm currently working on manifest stuff for #55

This should be live in the next release. Can you install the most recent @next tag and give that a try?

@mlynch Ok, I just tested it and it seems to work fine

@lucafulgenzi thank you! Will work on a formal release this week

2.0.8 is out with this feature, thanks!

Hello @mlynch and sorry for the late response.

I can confirm it too. This is working perfectly ๐Ÿ‘

Hello. Mi permissions get duplicated run. I'm doing something wrond?

Any update on this, inject is keep on adding permission, if I am running command multiple time and I am using @trapezedev/configure": "^7.0.10-next.0",