Problems after compiling when phone is asleep

Kevin

Well-Known Member
Licensed User
Longtime User
I'm not sure when this started, but it used to be that I could compile my app and even if my phone was asleep when it finished installing and running, it was no big deal. Although come to think of it, I usually install using the B4A Bridge but am currently using ADB (at work on my notebook). When using ADB, the app runs automatically whereas when using the bridge it does not.

Anyway, if my phone is sleeping when the app is compiled and run, after waking my device up I notice that no settings have been loaded from my prefs file in the app. What's worse, I can't do much of anything in the app without getting the dreaded "object must be initialized.....". It is like nothing gets initialized correctly if the device is sleeping when the app first runs.

Is this normal when compiling over a USB cable if the device is sleeping when the app is automatically started? Does anyone else here see this behavior? I know it is an unusual circumstance but it bothers me. ;)
 

Kevin

Well-Known Member
Licensed User
Longtime User
I'll see if perhaps it is a problem that is caused by Activity_Resume firing twice.

Is that twice in a row after waking the device, or once when the app first runs, then again after waking?

This shouldn't be an issue in the "real world" but I fear it will happen somehow.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
I suspect it is something weird in my code but I'll have to look into it. I appreciate the info though, as it will help point me in the right direction.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
It took a while to figure out the exact problem in my code, but after moving some things from Activity_Resume to Activity_Create I finally managed to stop the error but then got a black screen after waking the device. That was fixed by moving code that shows a message box under certain circumstances when the app starts to a spot a little later on in execution.

Everything is fine now. Thanks again for pointing me in the right direction!
 
Upvote 0
Top