Deeplink Unity Android by iletai - 3


Unknown VersionUnknown LicenseUpdated 15 days agoCreated on July 24th, 2020
Go to source

Mobile deep linking

Build Status

When you working with Unity, we will facing some case trigger app/ads from another application. So in repository will help you make that clearly.

  • Sample Unity Project Listner URl when deeplink was click on Android Application
  • Sample Arr library deeplink Android
  • Notes and know issues

Config Android Studio to build Java Library

  • Create blank application on Android Studio

  • Config build.gradel(Module:app) apply plugin: ''

  • Config Appmanifest.xml

  • Integraion lib java of Unity Engine to our lib:

    • Redriect to Unity/PlaybackEngines/AndroidPlayer/Variations/mono/Release/Classes.jar and copy it

    • Paste it on

    • In build.gradle. Remove applicationId ""

    • Create a new class to call native code: public final class TLDeeplink extends from UnityPlayerActivity we was import in before step. Define a key to save it to storage device in Unity. private String DEEP_LINK_URL_KEY = "deeplink"; @Overwrride function of Android onCreate and save that key was define to storage device Android. When user trigger from link, App will connect to that function and writedown key. In Unity only get key and value on it. Build to get library .aar. More detail in project android library of repository

What is mobile deep linking?


Deep link in the context of the web is a hyperlink linking to a specific content instead of a homepage of a website. The term mobile deep linking stands for the ability to link specific content of a mobile app with the use of URIs, which allows users to share content outside the traditional boundaries of the application. Tapping a deep link on a mobile device will open the application in question and show the linked content to the user. If the application was not already installed on the system, app store page will be presented to the user as illustrated

Flow function

How to implement

Sample behavior trigger:


Using on Sample Unity

  • Create file AndroidManifest.xml .
  • Param android:name package name and class java created.
  • Param android:scheme is your application name in PlayerSettings here
<?xml version="1.0" encoding="utf-8"?>
          android:name="android.intent.action.MAIN" />
          android:name="android.intent.category.LAUNCHER" />
          android:scheme="dlsample" />
          android:name="android.intent.action.VIEW" />
          android:name="android.intent.category.DEFAULT" />
          android:name="android.intent.category.BROWSABLE" />

Create and save AndroidManifest.xml to folder with exactly path: Assets/Plugins/Android/ Unzip file .aar in ..\AndroidLibrary\app\build\outputs\aar of frist step and copy file .jar to Assets/Plugins/Android/

Create an script to get key in sample app:

$  gameObject.GetComponent<Text>().text = PlayerPrefs.HasKey("deeplink") ? PlayerPrefs.GetString("deeplink") : "Your application don't start with deeplink";


  • Created a html file and copy it to device:
<!DOCTYPE html>



    <p>Hello. Do you want to visit the website <a href="dlsample://a?b">Result</a>?<br />
        It's a good website! ;-)</p>


Result success when you click tag a in html file. File will open your app unity was build in device. And show link by storage if that trigger from deeplink. And package of this sample here: Release

Show all projects by iletai