tryReregisterDevice method
Tries to re-register the device with the deployment service.
Since there is no way to update a registration, this method first tries to unregister the device and then, 5 seconds later, to register it again. Returns before the new registration is done.
Implementation
Future<void> tryReregisterDevice(DeviceConfiguration device) async {
await tryUnregisterDisconnectedDevice(device);
// Wait for a few seconds before trying to register the device again,
// to give the deployment service some time to process the un-registration.
Future.delayed(Duration(seconds: 5), () async => await tryRegisterConnectedDevice(device));
}