Home > Mobile >  taking photo with ionic capacitor (requires permission?)
taking photo with ionic capacitor (requires permission?)

Time:01-05

i followed a tutorial to create ionic capacitor app: https://github.com/stardvst/phototagger

i'm running it on android studio virtual device, and when i click on the button to take a photo, i get an error in log:

5235-5235/io.ionic.starter E/Capacitor/Console: File: http://localhost/main.86fcc9d3f8e066d4.js - Line 1 - Msg: ERROR Error: Uncaught (in promise): Error: Missing the following permissions in AndroidManifest.xml:
    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_COARSE_LOCATION
    
    Error: Missing the following permissions in AndroidManifest.xml:
    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_COARSE_LOCATION
    
        at returnResult (http://localhost/:745:32)
        at Object.win.androidBridge.onmessage (http://localhost/:720:21)

i suppose i should add some permission somewhere in android project files?

please help understand.

CodePudding user response:

As per documentation of @capacitor/geolocation you have to add the required permissions to the AndroidManifest.xml:

This API requires the following permissions be added to your AndroidManifest.xml:

<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" />
  • Related