Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Android app and user permissions

I have an Android Cordova app and I'm using GPS, check the network state, read/write on the Documents folder and taking camera pictures. Here my permissions on the manifest XML file:

<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" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

The manifest file is auto generated by the Cordova framework. For some reason I don't see camera permissions. Permissions are not asked at installation time anymore (that's since Android 6) but instead they should be asked before usage. I correctly get the GPS access permission popup but not the read/write Documents folder permission. I also never get the camera permission albeit I'm able to use it without ever being asked for permission. Same story for the Network status permissions (never being asked).

I find Android permissions scheme extremely confusing, under application manager my app has got Location and Storage as expected, Camera and Network status are missing though.

To recap, inside the app, on the actual code, I'm using at least once those devices

  • GPS fine grained
  • GPS coarse (probably the Wifi SSID triangulation trick)
  • Write on Documents
  • Read on Documents
  • Read network status (Offline / Wifi / 3G etc..)
  • Take picture from the camera

Cordova framework wrote this manifest file:

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.ACCESS_FINE_LOCATION
  • android.hardware.location.gps (why is it not a .permission?)
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.WRITE_EXTERNAL_STORAGE

On application manager I get those options:

  • Location
  • Storage

So basically I get three different sets of permissions :-(

like image 362
Gianluca Ghettini Avatar asked Nov 19 '25 00:11

Gianluca Ghettini


1 Answers

I found this in the this cordova plugin that you mentioned in comments.

enter image description here

So somehow this <uses-permission android:name="android.permission.CAMERA/> have to be in your code so as this plugin can use it.

Maybe you didn't check the right program to see its permissions, or if the camera permission is not shown in application permissions on device, you can't be able to use camera in this application. Please do a check again because I really want to know what is the situation.

like image 122
Akram Avatar answered Nov 21 '25 15:11

Akram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!