Skip to content

Latest commit

 

History

History
30 lines (28 loc) · 2.45 KB

IntegrationGuides.md

File metadata and controls

30 lines (28 loc) · 2.45 KB

Integration Guide

The following steps are only required if the main unity-container is (already) overridden in your project, by you or a plugin. More specifically, something is subclassing UnityPlayerActivity (the main, 'container' activity) on Android and/or UnityAppController on iOS, respectively.

Android

  1. Merge the code from SharedUnityPlayerActivity into your own activity or subclass SharedUnityPlayerActivity instead and make sure to call super.onCreate(Bundle savedInstanceState) and/or super.onNewIntent(intent) if you have overridden the onCreate or onNewIntent methods.
  2. Modify your existing AndroidManifest.xml to include the required placeholder variables and manifest entries.
    • A basic AndroidManifest.xml is included with the plugin, it has placeholder variables that are replaced as a pre-build step when building in Unity, you can use it as a guide of which changes you need to make to your existing AndroidManifest.xml.
    • Make sure the package is using a placeholder variable instead of a hard-coded package name, this placeholder will be replaced with whatever the bundle-id is set to in Unity's PlayerSettings eg. com.YourCompany.YourProduct
      <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${applicationId}" ...
    • In the main activity, replace "[YOUR_ACTIVITY_CLASS_NAME]" with the name of your custom activity name.
      activity android:name="${applicationId}.[YOUR_ACTIVITY_CLASS_NAME]" ...
    • Then add the following inside the same (main) activity tag, inside the <intent-filter> tag
      <!-- Deeplinks.Plugin[start] -->
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="${deeplinkScheme}" />
      <!-- Deeplinks.Plugin[end] -->

If you don't have your own AndroidManifest.xml, yet you can fetch a unity-generated one by first triggering a build and then copying it from UnityProject\Temp\StagingArea\AndroidManifest.xml into Assets/Plugins/Android/AndroidManifest.xml

iOS

Merge the code from UnityDeeplinks.mm into your own app-controller, taking care to either delete UnityDeeplinks.mm from your project or comment out IMPL_APP_CONTROLLER_SUBCLASS(UnityDeeplinksAppController) in the UnityDeeplinks.mm file.