Hey, anyone has any idea about creating a tablet e...
# android
s
Hey, anyone has any idea about creating a tablet emulator without a built-in hardware camera feature. So, I could test the application for my workflow.
l
I think you can do that in the AVD Manager by selecting "Create Hardware Profile" https://developer.android.com/studio/run/managing-avds#createhp
s
Thanks for your response. Actually, I was able to create an emulator without built-in camera, but the thing is whenever I check whether the camera feature is supported or not for such emulator, then it results in giving the true response everytime. Even if the camera feature is not supported.
l
What function are you using to check?
s
packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) It detects whether the device support camera feature or not. In my case it returns true even if I ran the application on emulator that doesn't have built-in camera feature
l
I think you'd want to call this function and wrap it in a try/catch: https://developer.android.com/reference/android/hardware/camera2/CameraManager#getCameraIdList()
s
Yeah, I thought of it and tried that too. It also detects 2 cameras for such emulators.
Thanks @luke. It worked by using the CameraManager API. I was using the old emulator that has camera, so got that result. Thanks for you response.
l
Nice one. I should have read your message earlier, I just knocked up a sample 😄
s
Oops! Btw thanks for your efforts.
👍 1
l
👍🏻 1