본문 바로가기

안드로이드

URI Scheme, AppLink, Deferred depp Link 정의

1. URI Scheme

앱에 URI 스킴(scheme) 값을 등록하여 딥링크 사용

URI Scheme은 딥링크의 가장 초기 형태로, 가장 일반적으로 사용되는 딥링크 방식이라고 할 수 있습니다. 앱을 개발하는 주체가 각 앱 내 특정 페이지마다 고유한 주소(링크)를 자유롭게 설정하여, 해당 주소(링크)를 클릭하면 앱이 열리고 특정 페이지가 열리는 형태입니다. 인터넷에서 흔히 사용하는 URL 주소처럼 링크를 클릭하면 특정 웹사이트가 열린다고 생각하면 쉽습니다. 이때 URL은 대개 http:// 혹은 https:// 로 시작된다면, URI Scheme은 각 모바일 앱에서 지정한 Scheme 값으로 시작합니다.

 

2. App Link

도메인 주소를 이용한 딥링크 사용

App Links는 Android에서 제공되는 딥링크 형태로, OS에 앱에 대한 도메인 주소를 등록함으로써 소유권을 증명하는 겁니다.

 

3. Deferred Deep Link

디퍼드 딥링크는 앱이 설치되지 않은 유저에게 설치 후 기대했던 서비스를 제공할 수 있습니다.

앱 미설치 유저의 경우, 앱을 설치하고 실행하여도 그 정보가 유실되지 않아 앱 내 특정 페이지로 이동하게 됩니다.

[4]

 

앱 콘텐츠 딥 링크 만들기

AndroidManifest.xml

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
 
    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter >
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="myappscheme"
                    android:host="myapphost"/>
            </intent-filter>
            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
 
</manifest>
cs
  • Scheme 값: 앱 개발자가 정한 값으로 앱을 구분
  • Path: 앱 내 특정 페이지를 지정

data 태그에서 Scheme가 myappscheme이고 host가 myapphost 이므로 주소는 myappscheme://myapphost 가 됩니다. [2]

 

URI Scheme 앱에서 호출

 

1
2
3
4
5
6
7
8
9
10
11
        button.setOnClickListener(object: View.OnClickListener{
            override fun onClick(v: View?) {
                val urlScheme = "myappscheme://myapphost"
                val intent = Intent()
                intent.action = Intent.ACTION_VIEW
                intent.addCategory(Intent.CATEGORY_BROWSABLE)
                intent.addCategory(Intent.CATEGORY_DEFAULT)
                intent.data = Uri.parse(urlScheme)
                startActivity(intent)
            }
        })
cs

[5]

 

실행결과

 

URI Scheme 웹에서 호출 

예제코드 [6]

<a href="intent://myHost/#Intent;scheme=myScheme;package=com.example.myapp;end"> 

링크문구

</a>

 

URI Scheme 웹에서 호출 실습 방법

 

1. 블로그에서 예제코드를 프로젝트(Host: myapphost, Scheme: myscheme)에 맞게 변경하여 HTML 코드를 삽입합니다.

2. 모바일로 블로그에 들어와서 실습링크를 클릭하고 해당 앱이 켜지는지 확인합니다.

 

 

 

실습 링크

MyApp 실행 링크

 

 

실행결과

 

 

참조:

[1] Android 딥 링크 - URL Scheme

https://jaeryo2357.tistory.com/84

 

[2] 앱 콘텐츠 딥 링크 만들기

https://developer.android.com/training/app-links/deep-linking?hl=ko 

 

[3] 딥링크의 모든것(feat. App Link, Universal Link, Deferred DeepLink)

https://medium.com/prnd/%EB%94%A5%EB%A7%81%ED%81%AC%EC%9D%98-%EB%AA%A8%EB%93%A0%EA%B2%83-feat-app-link-universal-link-deferred-deeplink-61d6cf63a0a5

 

[4] 딥링크101 마케터와 개발자를 위한 딥링크 시작하기

https://www.airbridge.io/blog-ko/deeplink-101-for-marketers-and-developers

 

[5] [Android] 웹뷰 webview window.open 처리 (웹뷰 고급편)

https://helloit.tistory.com/366

 

[6]

https://busydeveloper.tistory.com/entry/Custom-URI%EB%A1%9C-%EC%9B%B9%EC%97%90%EC%84%9C-%EC%95%B1-%ED%98%B8%EC%B6%9C%ED%95%98%EA%B8%B0