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?
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}