Reputation: 33
When I launch my android app in InstantApp mode, it fails to open camera even after granting relevant Camera permission.
I am creating Android Instant App where a user can capture an image and upload on the server.
I am using Camera2 API. InstantApp doesn't allow MediaStore.ACTION_IMAGE_CAPTURE
intent as Android doesn't permit external storage permission.
The app is able to open Camera after asking relevant permission if I launch in normal (non-instant) mode.
But When I launch in InstantApp mode, it fails to open the camera. I see these logs in logcat.
09-26 07:33:29.104 7846-7846/com.project.snapdrive I/CameraManagerGlobal: Connecting to camera service
09-26 07:33:29.174 7846-7846/com.project.snapdrive I/CameraManager: Using legacy camera HAL.
09-26 07:33:29.182 7846-7891/com.project.snapdrive W/Camera: An error occurred while connecting to camera 0: -74 (Not a data message)
If you want to have a look at code, My Project is here.
I am using emulator Nexus 5X, Android 6.0, API 23.
Upvotes: 3
Views: 604
Reputation: 2523
That looks like a bug reproducible on the Android O. It could be reproduced as well with the sample Camera2Basic project adapted into an Instant App: Sample code
Can you check status of bug on the Google tracker for update of this bug.
UPDATE
=======
This issue has been fixed and rolled out on 8.1 devices already.
We are working with our partners to roll out the fix into the update for 8.0 devices.
We expect those updates to be rolled out in the coming months.
Upvotes: 1