Android Question Photos camera

Jorgelcr

Active Member
Licensed User
Longtime User
Hello,

I use the following code to upload images from gallery or camera to upload them to an FTP and works perfectly on almost all devices that I have tested, the problem is that I have tested it on a Huawei P8 Lite (Android 5) mobile and with this code no Lets upload the photos from the camera option, another client also indicated that in his mobile (Chinese) when he chose the gallery option and clicked on the image did not show the option (ok, Cancel) to choose the photo.

Are there any incompatibilities with Android versions?
Any solution?

Thank you!!!

B4X:
Sub imgfoto_Click
    Dim resultfoto As String
    resultfoto=Msgbox2 ("¿Qué desea realizar?","","Cargar Foto","","Hacer Foto",LoadBitmap(File.DirAssets, "logoprincipal.png"))
    name=""
    If resultfoto= DialogResponse.POSITIVE Then
        Try
      
            Galeria(DirmTMPFoto, "imgfoto.jpg")
            name="imgfoto.jpg"
         
    Else
        If resultfoto=DialogResponse.NEGATIVE Then
            camera(DirmTMPFoto, "imgfoto.jpg")
            name="imgfoto.jpg"
        End If
      
      
    End If
End Sub


''''''''''''''''''''''''''''''''''''' CAMERA + CROP '''''''''''''''''''''''''''''''''''''''''''''
Sub camera(Directory As String, PictureName As String)
    Dim i As Intent
    onoff = True
    i.Initialize("android.media.action.IMAGE_CAPTURE", "" )
    i.PutExtra("crop", "true") 'crop ON
    i.PutExtra("aspectX", 0) 'crop aspects
    i.PutExtra("aspectY", 0) 'crop aspects
  
  
    i.PutExtra("outputX", 200) 'crop size
    i.PutExtra("outputY", 150) 'crop size
    i.PutExtra("output", ParseUri("file://" & File.Combine(Directory, PictureName))) 'output folder you set OpenCam(File.DirRootExternal, "1.jpg")
    StartActivity(i)    
End Sub

Sub ParseUri(filename As String) As Object
Dim r As Reflector
Return r.RunStaticMethod("android.net.Uri", "parse", Array As Object(filename), Array As String("java.lang.String"))
End Sub
 
Top