inAndroidApp method

Future<bool> inAndroidApp()

Parses uri and opens Youtube's android app if installed, else platform handles it.

Implementation

Future<bool> inAndroidApp() async {
  // only works on android
  assert(Platform.isAndroid, 'Platform is not android');

  // If android, try launching URL with intents
  try {
    final intent = AndroidIntent(
      action: 'action_view',
      data: uri.uriHttpsScheme,
      arguments: {
        "force_fullscreen": _forceFullscreen,
      },
    );
    await intent.launch();
    return true;
  } catch (e, s) {
    log(
      'Failed to launch URL via intent on android',
      level: Level.SEVERE.value,
      error: e,
      stackTrace: s,
    );
  }
  return false;
}