Android Question Intent Based camera crashes

John Leeson

Member
Licensed User
Longtime User
Hello,

I have already posted about this ( see previous ) but I have now done some further testing, using the example here, and with the 'KeepRunningService', and the example crashes every time the device is landscape.

The device is a samsung galaxy A53. This is all that the logs show:

filtered log:
** Activity (main) Pause event (activity is not paused). **
sending message to waiting queue (OnActivityResult)
** Activity (main) Create  **
Using FileProvider? true
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
running waiting messages (1)
Orientation: 1
** Activity (main) Resume **
** Service (keeprunningservice) Start **
** Activity (main) Pause event (activity is not paused). **
** Activity (main) Create  **
Using FileProvider? true
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
** Service (keeprunningservice) Start **

This is a major issue for me which, other than telling users to take photos in portrait, I haven't been able to figure out. I have attached the unfiltered logs too in case they are useful.

I would really appreciate some advice on this!

Thank you
 

Attachments

  • unfiltered_logs.txt
    421.1 KB · Views: 96

John Leeson

Member
Licensed User
Longtime User
It seems to run fine until it gets to this line

B4X:
CallSubDelayed3(Me, "Image_Available", bmp.IsInitialized, bmp)

Works every time in portrait and never in landscape!
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
When the screen orientation changes, Android generally destroys your app's activities & then reloads them - so it might have something to do with that. Have you tried starting the app in landscape & seeing if it works then (ie: don't change the orientation while the app is running)?

- Colin.
 
Upvote 0

John Leeson

Member
Licensed User
Longtime User
Thanks Colin, No, that makes no difference. It's interesting - I added a line to the end of this sub - and it actually reaches the end of the code before it restarts - I see that in the log, but then it restarts - I'm stumped.

B4X:
Sub Button1_Click
    TakePicture (ImageView1.Width, ImageView1.Height)
    Wait For Image_Available(Success As Boolean, bmp As B4XBitmap)
    Log("Success: " & Success)
    If Success Then
        Try
            
            ImageView1.SetBitmap(bmp)
        Catch
            Log(LastException)
        End Try
    End If
    Log("image set ")
End Sub
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
So you don't see any exceptions logged - just your Log statements? And your Success paramater is true?

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Also - what is ImageView1? Is it expecting a B4XBitmap, or a Bitmap? Are they the same? (I've never used a B4XBitmap so I'm not sure)

- Colin.
 
Upvote 0

John Leeson

Member
Licensed User
Longtime User
ImageView1 is a B4XView - it's the B4XPages camera intent example if you want to check it out. Example

It seems like it's device specific as the exact same app does work on other devices - although I've had intermittent problems, but on this device it crashes every single time in landscape, and never in portrait.

I've tried setting the camera to use a 1:1 ratio to take square photos, and rotating the image using the exif data, neither of them make any difference.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
What package name are you using - asbestoslab.survey?

- Colin.
 
Last edited:
Upvote 0

John Leeson

Member
Licensed User
Longtime User
mmm - not for this example, but that is an app that also has the same issue - was that in the detailed logs? I noticed the issue in that app and then switched to the original example to see if it was something I'd one to break it. I think the package for the example is just b4a.example
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
mmm - not for this example, but that is an app that also has the same issue - was that in the detailed logs? I noticed the issue in that app and then switched to the original example to see if it was something I'd one to break it. I think the package for the example is just b4a.example
Yeah - asbestos.survey is the package name in the unfiltered logs...

- Colin.
 
Upvote 0
Top