Android Question camera intent Filipo's modification

cristian petersen

Member
Licensed User
Longtime User
I am trying camera intent Filipo's modification.
https://www.b4x.com/android/forum/threads/intent-based-camera.69215/page-2#post-610699

I deployed as is, in Release mode B4a 8.50 to a Samsung S8.
The first run I got the permission dialogs, allowing them and after that I got this error:
View attachment 75017
The second run there is no more error, but it saves the picture into tempimage.jpg in b4a.example3/files/shared no in DCIM/Camera/Test.jpg

I need to implement the same functionality. from my app take a picture and save it to sqlite database.
 

cristian petersen

Member
Licensed User
Longtime User
Thank You Erel.

For the error in the first run:
changed in Button_Click

B4X:
If Starter.rp.Check(Starter.rp.PERMISSION_CAMERA) And Starter.rp.Check( Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE) Then
        TakePicture
Else
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
End If

to this code
B4X:
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
    Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
    If Result Then
        Log("permiso de camera")
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
        If Result Then
            Log("permiso de storage")
            TakePicture
        Else
            Log("No tiene permiso de storage")
        End If
    Else
        Log("No tiene permiso de camara")
    End If
 
Upvote 0
Top