Android Question Cam1_ready event does not raise

Discussion in 'Android Questions' started by robotop, May 18, 2015.

  1. robotop

    robotop Member Licensed User

    Hi all, I have a simple application that captures pictures from camera. I'm using just the basic commands from Camera V2.20 library. Normally, the application runs correctly, but sometimes (while connected to B4A bridge) after uploading a new release after some bug fix, the Cam1_Ready event does not raise anymore. This behaviour continues even if I force the application to close with the application manager, then restart it. Also, in such situation, if I launch the standard Android "Photo" application, I receive a black screen with the error: "impossible to connect to the camera". Is there any way to unlock/reset the camera ? At this moment, I have to turn off (then on) the phone to restore the working conditions.
    Any help will be highly appreciated, thanks.

    P.S. I'm running the App on Samsung Galaxy Nexus phone
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that your app properly closes the camera when the activity is closed.

    Close the activity before you deploy a new release (and wait a few seconds to let the camera close).
     
  3. robotop

    robotop Member Licensed User

    Hi, Erel. Thanks for your answer. I actually use Camera1.Release in Activity_Pause and Camera1.Initialize(Panel1, "Cam1") in Activity_Resume. When compiling with the B4A-Bridge connected, the phone immediatly starts a new installation of the App. It's possible that the eventually running App will not be properly closed in such case ? Anyway, I'll follow your suggestion to close the old App and wait for some seconds before uploading the new one.
    In case of camera lock, is there some trick to create a Camera Reset ? I have tried to make repetitive Camera1.Release - pause - Camera1.Initialize and also some Panel1.Invalidate, but without success. Please, tell me if there is a way to do this.
    Thank you.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    When an app is reinstalled it is killed immediately (by the OS). It is the OS responsibility to release the camera in that case. On most devices, especially newer devices, the camera will not be locked when the process is killed.
     
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