Prevent bluetooth keyboard from losing connection to android tablet
The connection loss over bluetooth is a feature of the keyboard itself. 
Bluetooth 5 is little better than previous versions, but still you can only minimise the connection loss little because of the wireless nature of the connection and there is always a gap there which can lead to a connection loss. 
BT5 should however be much more stable but end devices are still short in supply. 

Differential solution: USB-C keyboard later if supported.