Android Question Native Camera Intent

Discussion in 'Android Questions' started by Rockefeller Goldman, Mar 14, 2018.

  1. Rockefeller Goldman

    Rockefeller Goldman Active Member Licensed User

    Hi,

    Wondering if anyone knows if it is possible to send Intent to the Native Camera to Auto-Snap Picture and then Exit

    Thank you guys in advance
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Rockefeller Goldman likes this.
  3. Indy

    Indy Active Member Licensed User

    Hi Erel

    I'm sure being the expert that you are you are correct in saying that an "auto snap" would not be possible. However, my query then is, if I load an activity which in-turn launches a Camera intent, is it not possible that at some point in that Activity a timer could be used to take a picture? I haven't tried this but I do have an app where I launch an Activity with a full camera view where a user clicks a button to take and save a picture to the sd-card. Theoretically then, would it not be possible for me to click the button click event on a timer and then once the picture is saved, exit the activity? What you think?
     
    Rockefeller Goldman likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    No. The camera intent starts a third party app. You don't have any control over that app.

    You can implement it with Camera or Camera2 libraries.
     
    Rockefeller Goldman likes this.
  5. MarkusR

    MarkusR Well-Known Member Licensed User

    your request is similar a barcode reader app that just return the barcode and some other information, that works with zxing
    because its part of design and i guess it is used from StartIntentWithResult
    at my phone the camera app is from motorola and it seems this app not support it.
    would be good if all app developer think about automation.
     
    Rockefeller Goldman likes this.
  6. derez

    derez Expert Licensed User

    Using VBFrontcam library I do what you want (but without an intent). It can be done with any other camera library.
    The application is started by a service which calls the camera activity, it saves the picture and calls another service to send the picture and then the application is shutdown.

    Code:
    Sub Cam_Ready (Success As Boolean)
    Try
        
    If Success Then
            cam.StartPreview
            cam.TakePicture
            
    Log("take picture")
        
    End If
    Catch
        
    CallSub("runapp","send")
    End Try
    End Sub

    Sub Cam_PictureTaken (Data() As Byte)
        
    Dim out As OutputStream
        out = 
    File.OpenOutput(runapp.picdir, runapp.picfile, False)
        out.WriteBytes(Data, 
    0, Data.Length)
        out.Close
        cam.Release
        
    CallSub("runapp","send")
        
    CallSub(Main,"mainend")
    '    Log("cam closed")
        Activity.Finish
    End Sub
     
    Last edited: Mar 16, 2018
    Rockefeller Goldman likes this.
  7. Rockefeller Goldman

    Rockefeller Goldman Active Member Licensed User

  8. Rockefeller Goldman

    Rockefeller Goldman Active Member Licensed User

    Camera2 needs B4A 7.80? Then I upgrade next month :D
     
  9. Rockefeller Goldman

    Rockefeller Goldman Active Member Licensed User

    Good job Derez, but is this for the Native BUILT-IN Camera or CameraEx, Camera2?
     
    Last edited: Mar 18, 2018
  10. derez

    derez Expert Licensed User

    Yes
     
    Rockefeller Goldman likes this.
  11. Rockefeller Goldman

    Rockefeller Goldman Active Member Licensed User

    Givin' it a try tomorrow and let you know

    Thank you very much, Derez
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice