Android Question Camera2 Problem at Android 5

MarkusR

Well-Known Member
Licensed User
Longtime User
hello,
i will use the camera 2 but it gave me an error.
my device have 5.0.2 API 21 19. Dezember 2014
and it should work and i believe i tested it long ago and it worked.
at my tablet device with android 6.0 it works.

at os 5 the example said: Failed to open camera
B4X:
Sub OpenCamera (front As Boolean)
    rp.CheckAndRequest(rp.PERMISSION_CAMERA)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result = False Then
        ToastMessageShow("No permission!", True)
        Return
    End If
 
    SetState(False, False, VideoMode)
    Wait For (cam.OpenCamera(front)) Complete (TaskIndex As Int)
    If TaskIndex > 0 Then
        MyTaskIndex = TaskIndex 'hold this index. It will be required in later calls.
        Wait For(PrepareSurface) Complete (Success As Boolean)
    End If
    Log("Start success: " & Success)
    SetState(Success, False, VideoMode)
    If Success = False Then
        ToastMessageShow("Failed to open camera", True)
    End If
    Log(cam.ActiveArraySize)
End Sub

the used example:
https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/#post-531669
 
Last edited:

MarkusR

Well-Known Member
Licensed User
Longtime User
just found u updated this cameraex at 06/2018 my used source code was outdated.
https://www.b4x.com/android/forum/t...e-camera-library-functionality.23801/#content

yes there was LEGACY in log in camera2.

this cameraex(1) example have all feature that i need.
for any reason it ends the app after first test, i believe there is an issue with flash light and camera at my drevice.
second test works. i will try using this 06/2018 version thank you erel.

i had this error message in log.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…