I am using this sample https://github.com/NordicSemiconductor/Android-nRF-Blinky . I noticed that when device rotation is changed the device stills connected.
I changed the nrfBlinky to using UART. So that it can send & receive data.
When navigating to other activity or backpress the service is destroyed. But what I don't understand is why when rotating the devices the activity stills connected?
BlinkyViewModel // Connection states Connecting, Connected, Disconnecting, Disconnected etc. private final MutableLiveData<Boolean> mBondingState= new MutableLiveData<>(); public LiveData<Boolean> getBondingState() { return mBondingState; } @Override public void onBondingRequired(@NonNull final BluetoothDevice device) { // Blinky does not require bonding mBondingState.postValue(true); } @Override public void onBonded(@NonNull final BluetoothDevice device) { // Blinky does not require bonding mBondingState.postValue(true); } @Override public void onBondingFailed(@NonNull final BluetoothDevice device) { // Blinky does not require bonding mBondingState.postValue(false); } /////////////////////////////////////////////////////////////// BlinkyActivity mViewModel.getBondingState().observe(this, this::onBondingStateChanged); private void onBondingStateChanged(final boolean connected) { // mLed.setEnabled(connected); if (!connected) { mLed.setChecked(false); mButtonState.setText("KETUM"); } }