Handling gl context lost in android

i get some rare crash reports when swapping buffers that i couldnt reproduce.
i suspect that android os is freeing the gl context.

i was wondering if any one can suggest a proper way of identifying when the gl context have been destroyed unexpectedly so i can re init every thing again?

We may be having a related issue. Does this seem to affect primarily Samsung Galaxy J devices, Galaxy S3, pixel 2…?

it can happen on all devices, run your app, move it to background then open and use other apps, you can notice using adb/android studio profile the memory usage of the app get reduced until it get killed.