I have a MVVM app, which needs Bluetooth through the entire app. The only screen that doesn't require Bluetooth is the Onboarding screen. In the first screen, the app starts automatically searching for devices, which requires BLUETOOTH_SCAN to function properly. I have attempted numerous things to request the runtime permissions and check if the Bluetooth is on, but nothing seemed to work. I'd greatly appreciate any help.
I have tried calling the functions in the onResume() of the activity, but it slows down the app a significant lot. I have also tried requesting the permissions when the startScan() function gets called, but that seems to crash, because in order to start the scan I need to have the permissions allowed and the bluetooth adapter should be initialized, a.k.a Bluetooth should be turned on