Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

980
Views
How to allow access to camera in Android WebView

I wanted to load a website in Android WebView which uses a device camera. But on Android WebView I'm not able to access the device camera

When I run: navigator.mediaDevices.getUserMedia({ video: true }) in JavaScript It does not ask for permission for camera and gives following error:

enter image description here

I have added the following permissions in AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Thank You!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You will still need to request the user grants permission for your app to use the camera. I don't think you can request permission for this within your WebView (you can implement a JavaScript interface though to trigger it via your web app), so you will need to do it natively in Java/Kotlin on your app (maybe you want to do this on boot)

You can request permission by doing something like this

    requestPermissions(this, arrayOf(Manifest.permission.CAMERA), REQUEST_CODE)

You can see more info on requesting permissions to use hardware on Android here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!