Can I draw to your attention this note that I have added to the BBCSDL documentation:
"BASIC programs using the shaderlib or webgllib libraries will run in Android but on some devices they may crash if sent to the background and then returned to the foreground. The variability between devices arises because some use graphics drivers that are better able to restore custom shaders after backgrounding than others. Unfortunately this is unavoidable so don't use those libraries in programs intended to run in Android if you are concerned".
An example of the variability is that on my OnePlus phone I can put a program using shaderlib or webgllib into the background, and later return it to the foreground, and it keeps running perfectly fine. But if I do that on a Samsung Galaxy tablet it crashes every time! Doing the same thing in iOS seems to work reliably on all devices, but that's because Apple has more control over the internals.
It's a price you pay for the more 'open' nature of Android.
Using shaderlib and webgllib in Android
-
Richard Russell
- Posts: 598
- Joined: Tue 18 Jun 2024, 09:32
-
Richard Russell
- Posts: 598
- Joined: Tue 18 Jun 2024, 09:32
Re: Using shaderlib and webgllib in Android
You can receive a notification when your app returns to the foreground by trapping ON MOVE and testing for the @wparam% value being zero, which if you are lucky may allow you to avert the crash. But the problem with that approach is that the right course of action depends on whether it's running on a device which crashes, or one which doesn't. Taking measures to avert a crash when you don't need to could make things worse, not better!Richard Russell wrote: ↑Sat 07 Mar 2026, 12:37 on some devices they may crash if sent to the background and then returned to the foreground.