Hi everyone, I'm using this method by
@Erel to take a picture from Android in my app released months ago.
Since some days, some customers told me that the "take picture" button is not working anymore, randomly.
After some investigation in
my code, I could not find the problem... the only thing I noticed was that the notification that should appear from the "KeepRunningService" is not shown.
I tried starting from the
original example code, excluding all my things in this way.
This solution will not work with Android 14+. Please use the more powerful MediaChooser instead: [B4X] MediaChooser - cross platform videos and images chooser B4A + B4i project that uses an intent in B4A and the Camera object in B4i to take a picture using the default camera app. The B4A code...
www.b4x.com
And i manged to replicate at least one scenario that can cause the problem, it proves that there is some sort of problem.
Spoiler: WORKING PROCEDURE
Open the App
Click on the only button to take a picture (but the notification still not shown even with the original code, I remember in the past that it was shown)
System camera opens
Take a picture
Confirm
See the result in the ImageView
You can repeat this procedure as many times you want, it will work (based on my repeated tests)
After confirming that with this flow it works correctly, proceed by doing the following in order to
TRIGGER THE BUG :
Put a breakpoint on line 58 Wait For ion_Event (MethodName As String, Args() As Object)
Execute one more time the WORKING PROCEDURE explained above
The code will be blocked on the breakpoint, simply go on (it will work)
TRY AGAIN TO TAKE A PICTURE
At this point it will
no longer work ... and there is more, the
Button_Click sub is not trigger anymore... is like the button is not liked with its event anymore...
At minute 0:13 the long pause is because I'm setting the breakpoint
What could be the problem
?
Thanks in advance