How to use the xdl.Android.openProjectAsync function in xdl

To help you get started, we’ve selected a few xdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sysgears / apollo-universal-starter-kit / tools / webpack.run.js View on Github external
async function startExpoProject(config, platform) {
  try {
    const projectRoot = path.join(path.resolve('.'), '.expo', platform);
    setupExpoDir(projectRoot, platform);
    await startExpoServer(projectRoot, config.devServer.port);

    const address = await UrlUtils.constructManifestUrlAsync(projectRoot);
    console.log(`Expo address for ${platform}:`, address);
    console.log("To open this app on your phone scan this QR code in Expo Client (if it doesn't get started automatically)");
    qr.generate(address, code => {
      console.log(code);
    });
    if (platform === 'android') {
      const { success, error } = await Android.openProjectAsync(projectRoot);

      if (!success) {
        console.error(error.message);
      }
    } else if (platform === 'ios') {
      const { success, msg } = await Simulator.openUrlInSimulatorSafeAsync(address);

      if (!success) {
        console.error("Failed to start Simulator: ", msg);
      }
    }
  } catch (e) {
    console.error(e.stack);
  }
}
github react-community / create-react-native-app / react-native-scripts / src / scripts / start.js View on Github external
async function handleKeypress(key) {
  switch (key) {
    case CTRL_C:
    case CTRL_D:
      process.emit('SIGINT');
      return;
    case 'a': {
      clearConsole();
      log.withTimestamp('Starting Android...');
      const { success, error } = await Android.openProjectAsync(process.cwd());
      if (!success) {
        log(chalk.red(error.message));
      }
      printUsage();
      return;
    }
    case 'i': {
      clearConsole();
      log.withTimestamp('Starting iOS...');
      const localAddress = await UrlUtils.constructManifestUrlAsync(process.cwd(), {
        hostType: 'localhost',
      });
      const { success, msg } = await Simulator.openUrlInSimulatorSafeAsync(localAddress);
      if (!success) {
        log(chalk.red(msg));
      }
github NervJS / taro / packages / taro-rn-runner / src / index.js View on Github external
async function handleKeypress (key) {
  switch (key) {
    case CTRL_C:
    case CTRL_D:
      process.emit('SIGINT')
      return
    case 'a': {
      clearConsole()
      log.withTimestamp('Starting Android...')
      const { success, error } = await Android.openProjectAsync(projectDir)
      if (!success) {
        log(chalk.red(error.message))
      }
      printUsage()
      return
    }
    case 'i': {
      clearConsole()
      log.withTimestamp('Starting iOS...')
      const localAddress = await UrlUtils.constructManifestUrlAsync(projectDir, {
        hostType: 'localhost'
      })
      const { success, msg } = await Simulator.openUrlInSimulatorSafeAsync(localAddress)
      if (!success) {
        log(chalk.red(msg))
      }
github react-community / create-react-native-app / react-native-scripts / src / scripts / android.js View on Github external
async function startAndroidAndPrintInfo() {
  const address = await UrlUtils.constructManifestUrlAsync(process.cwd());
  log.withTimestamp('Starting Android...');

  const { success, error } = await Android.openProjectAsync(process.cwd());

  qr.generate(address, qrCode => {
    log.withTimestamp(`${chalk.green('Packager started!')}`);
    log(
      `
To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.

${indent(qrCode, 2)}

Or enter this address in the Expo app's search bar:

  ${chalk.underline(chalk.cyan(address))}

Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit ${chalk.underline(chalk.cyan('https://expo.io'))}.
github expo / xde / src / ui / toolbar / ToolBar.js View on Github external
_simulatorAndroidAsync = async () => {
    return await Android.openProjectAsync(this.props.projectRoot);
  };
}
github expo / exp / src / urlOpts.js View on Github external
async function handleMobileOptsAsync(projectDir, options) {
  if (options.android) {
    await Android.openProjectAsync(projectDir);
  }

  if (options.ios) {
    await Simulator.openProjectAsync(projectDir);
  }

  return !!options.android || !!options.ios;
}