๐Ÿ“ฑReact Native

Supporting Mobile Accessibility to your Event for Users

You can directly embed an Mยฒ streaming client into a WebView in your own React Native app. You can see the required configuration in our example app and, by following the guide below, you can test the end-to-end flow!

Downloading and Setting Up the Project

Download our Example Project

Navigate to our public github repository here:

https://github.com/msquared-io/msquared-react-native-webview

This contains all the code you need to run an example mobile application using Expo Go.

The example will connect you to one of our public-facing persistent worlds that is open to all users, and gives you an example of what joining an experience via the WebView looks like.

Download and extract a copy of this project into a directory of your choosing.

Also ensure you download Expo Go onto your device:

For Native Devices

  • You should be able to find the Expo Go app in the relevant app store for your device. Simply download and install. The app should look like the below:

For Emulators:

  • Download the relevant emulator. E.g. for Android, you can download the latest version of Android Studio, and spin up their default "Medium Phone" virtual device.

  • Download Expo Go for emulators via the link above. You should find a file named Exponent-[version #].apk .

  • Drag the .apk file onto your virtual device to install app on the emulator

Installing project packages

Once your device OR emulator is set up:

Navigate to the project directory in your terminal, and run: npm i . If successful, you should see output in your terminal that looks something like this (this command may find vulnerabilities; this can be safely ignored in most cases, but you are free to address these issues in your project should you wish):

Ensure you have NodeJS installed before attempting to run npm i, otherwise this command will fail

Starting Up the Project on your Device

Once you've installed all the relevant packages, and Expo Go is is up and running on your device/emulator, in your project repo execute:

  • npx expo start

If this command does not work on your native device (e.g. your android phone), execute a different command in your terminal from your project directory:

  • npx expo start --tunnel - this will allow your device to connect to your development project.

This may require you to install an additional package: The package @expo/ngrok@^4.1.0 is required to use tunnels, would you like to install it globally?

  • Simply enter 'y' to accept and install.

You can now either scan the QR code, or copy and paste the relevant exp:// url from the logs into the expo app. This should load an example landing page, from which you can enter our example MSquared world.

If successful, you should see the experience run in your device/emulator as shown in the example at the top of this page!

Last updated