skip to Main Content

I Have created a android application from unity and installed that into my phone. Also I have created another android application with react-native-expo. Now I need to link those two applications. So when I click on a specific button in the react-native-expo app it should launch the installed application created from unity.

I have tried expo-intent-launcher and expo-linking and both cannot open the installed application with the package name they need the apps intent’s URI to open.

2

Answers


  1. To link your React Native Expo app with your Unity app, you’ll need to make sure the Unity app can be opened via a custom URI scheme or intent filter. Here’s a general approach:

    1. Set Up the Unity App: Ensure that the Unity app has an intent filter configured in its Android manifest file. This filter allows the app to be launched via a specific URI scheme or an intent action. This might involve defining a custom URI (like myapp://) that the app can respond to.

    2. Launch the Unity App from React Native: In your React Native Expo app, you can use tools like expo-linking to open the Unity app via the custom URI or intent. For example, when a button is pressed in the React Native app, it would attempt to launch the Unity app using that URI.

    3. Verify URI/Intent Configuration: Ensure that the URI scheme or intent action is correctly set up in the Unity app’s manifest. This configuration allows the React Native app to identify and launch the Unity app.

    If the Unity app isn’t responding to the URI or intent, double-check that the manifest settings are correct and that the app is configured to handle the custom URI or intent you’re trying to use.

    Login or Signup to reply.
  2. If you handle deep linking in your unity app you will be able to achieve your task.

    However, I would suggest to create aar file from unity and load it in react native with custom native module. With this you will see single app only at end user’s device.

    Follow below steps for secondary option:

    Step 1: create AAR file from unity and place it in react native android directory.

    Step 2: update build.gradle file to include this AAR file in your RN app

    Step 3: Create custom native module to open and close unity app from your RN app.

    Step 4: handle this custom native method calls at desired places in your RN app

    Let me know If you have any doubt in these steps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search