setAutoRestart static method
Enables the auto restart setting.
Calling this API makes the current app be automatically restarted upon
termination. The given appControl
is passed to the restarting app.
This API is for platform developers only. The app must be signed with a platform-level certificate to use this API.
Implementation
static Future<void> setAutoRestart(AppControl appControl) async {
await appControl._setAppControlData();
final Map<String, dynamic> args = <String, dynamic>{'id': appControl._id};
final int? handleAddress =
await _methodChannel.invokeMethod<int>('getHandle', args);
final Pointer<Void> handle = Pointer<Void>.fromAddress(handleAddress!);
final int ret = appControlSetAutoRestart(handle);
if (ret != 0) {
final String message = getErrorMessage(ret).toDartString();
throw PlatformException(code: ret.toString(), message: message);
}
}