Android Question White screen at app startup when using a service


Licensed User

I made an app that acts as both a BLE central and BLE peripheral. All works fine when the central and peripheral managers are started in my main activity. Since I call a second activity for configuration, the main activity is paused and the BLE central/peripheral managers are paused/queued. To fix this, I initialized my BLE managers in a service. Now, the app can still process the BLE messages when second activity is started. It all works fine with me so I released the app.

Now, I get complaints that the app gets stuck at a white screen when the user restart the app. It works fine only once after installation but then they get a white screen. Rebooting the tablet/phone does not seem to cut it. They need to reinstall the app to make it work (only once) again. I initially did my init in the Starter service but had a similar issue. Now, I'm using a custom service called BLE_Service (code below). I read about services in B4A. I searched about white screens. I'm lost. Any help would be appreciated. I can't reproduced the issue myself so this is very frustrating.

#Region  Service Attributes
    #StartAtBoot: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Central As BLE_Central
    Dim Peripheral As BLE_Peripheral
End Sub

Sub Service_Create
    Log("BLE_Service created")
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
End Sub

Sub Service_Destroy
    Log("BLE Service destroy")
End Sub