launchApp method

  1. @override
Future<void> launchApp(
  1. String packageName,
  2. int serialNumber
)
override

Launches an app with the given package name and serial number.

This method sends a method call to the native platform to launch the app. If the app fails to launch, a message is printed in debug mode.

Implementation

@override
Future<void> launchApp(String packageName, int serialNumber) async {
  try {
    await methodChannel.invokeMethod('launchApp', {
      'packageName': packageName,
      'serialNumber': serialNumber,
    });
  } on PlatformException {
    if (kDebugMode) {
      print('Failed to launch app.');
    }
  }
}