Skip to content

Latest commit

 

History

History
118 lines (91 loc) · 2.87 KB

expo.md

File metadata and controls

118 lines (91 loc) · 2.87 KB

Usage in Expo Apps

These instructions are provided to help you configure your Expo app to work with this library. When using Expo there are two workflows: managed and bare. The instructions for each are slightly different.

iOS

Bare Workflow

See iOS directions.

Managed Workflow

Add the following to your Expo app's config file. This file is typically named app.json, app.config.js, or app.config.ts.

"ios": {
   "infoPlist": {
      "LSApplicationQueriesSchemes": [
        "comgooglemaps",
        "citymapper",
        "uber",
        "lyft",
        "transit",
        "truckmap",
        "waze",
        "yandexnavi",
        "moovit",
        "yandextaxi",
        "yandexmaps",
        "kakaomap",
        "szn-mapy",
        "mapsme",
        "osmandmaps",
        "gett",
        "nmap",
        "dgis",
        "lftgpas"
      ]
   }
}

Android

Bare Workflow

See Android directions.

Managed Workflow

Utilize the plugin system to add app intents to Expo prebuild step.

1. Create a plugin under src/plugins named android-manifest.plugin.js.

2. Add the following code to the plugin file.

const {withAndroidManifest} = require('@expo/config-plugins');

const supportedApps = ['geo', 'waze'];
const mapAppIntents = supportedApps.map((app) => {
  return {
    action: {
      $: {'android:name': 'android.intent.action.VIEW'},
    },
    data: {
      $: {'android:scheme': app},
    },
  };
});

module.exports = function androidManifestPlugin(config) {
  return withAndroidManifest(config, async (config) => {
    const androidManifest = config.modResults.manifest;
    const existingIntent = androidManifest.queries[0].intent;

    androidManifest.queries[0].intent = existingIntent.concat(mapAppIntents);

    return config;
  });
};

3. Add the plugin to your app's config file to have it run during prebuild.

{
  "plugins": ["./src/plugins/android-manifest.plugin.js"]
}

4. Confirm AndroidManifest.xml has been updated.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app">
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="geo" />
    </intent>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="waze" />
    </intent>
  </queries>
  <!-- Rest of Manifest -->
</manifest>

Rebuild your app

Don't forget to rebuild your app after making these changes.

You can usually do so by running expo build.

Also note that this will only work when building your own standalone app, not when starting your app through the Expo app in the App Store.