Hi,
OnPause, OnStop, OnResume, everything works like a charm. I am saving all my variables to TyniDB each time when I Pause and/or Stop. Loading them back when I start the app.
There one thing I cannot do: disconnect from BLE when I hit the home/pause button. I receive an error. I do not think it is possible but I would like to disconnect from BLE when I hit this button from anywhere in the app.
Anke
I did not use a timer yet. But the appears when I implement the BLE disconnect in the 'When.Onstop' block. In the 'When.Onpause' block no error but also no BLE disconnect.
The error says (at .Onstop):
Error 3300 Error 9500 Disconnect cannot be called before you are connected. There's no BluetoothLE device currently connected.
But that's strange because my connection is still valid (BLE connection-led is still ON at the receive side) and when I resume the app it is still operating over BluetoothLE as before.
It is a pity because I like the way the extension works. (automatic, you do not have to care about it)
As I said, use a timer and post a screenshot of the error message. And please show your blocks.
Does the disconnect method work if you use / execute it before you press the Home button?
What happens if you put this block in the Screen.BackPressed event? Do you get then the same error?
MY FAULT ! (Solved)
Activity Lifecycle works perfectly. For switching between BLE auto connection and manual connection I am using a flag. Flag was set wrong and AL connected immediately after disconnecting so it looked like BLE stayed connected.
I am using the BLE disconnect block in the .OnPause block only because the .OnStop is always advanced by the .OnPause (Works perfect now)
I am sorry to cause you these solution thoughts but it helped me to find the fault in my app