반응형
Notice
Recent Posts
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- JNI
- Kotlin
- git
- Android
- mqtt
- OZViewer
- 오즈뷰어
- firebase-storage
- Java8
- git-push
- AWS
- ozd
- firebase-database
- socket.io
- NoSuchMethodError
- mosquitto
- Flavors
- 워치
- google-login
- hung-up
- Galaxy Watch
- cloud-firestore
- ActivityResult-API
- socket-server
- BottomSheetDialog
- Dva
- socket-client
- Firebase
- gradle
- TIZEN
Archives
- Today
- Total
Hyeyeon blog
[Android] Kotlin - Firebase Dynamic Link 본문
반응형
1. Firebase 콘솔 에서 Dynamic Link 생성
2. 외부에서 접속하려는 Activity에 <intent-filter> 등록
- host에 콘솔의 [동적 링크 설정] -> [딥 링크 URL] 에 등록한 URL을 입력
<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:host="test.co.kr"
android:scheme="https"/>
</intent-filter>
3. createDynamicLink()
private val DEEPLINK_URL = "https://test.co.kr/"
private val SHORT_DYNAMIC_LINK = "https://test.page.link"
private val PACKAGE_NAME = "co.kr.test.dev"
private fun createDynamicLink(): String {
return FirebaseDynamicLinks.getInstance()
.createDynamicLink()
.setLink(Uri.parse(DEEPLINK_URL))
.setDomainUriPrefix(SHORT_DYNAMIC_LINK )
.setAndroidParameters(
DynamicLink.AndroidParameters.Builder(PACKAGE_NAME)
.build()
)
.buildDynamicLink()
.uri.toString() + "event/" + viewModel.event.event_no // https://URL/event/3 의 형태로 만들기 위해 추가
}
4. getDynamicLink()
FirebaseDynamicLinks.getInstance() .getDynamicLink(intent) .addOnSuccessListener { var deppLink: Uri? = null if (it != null) { deppLink = it.link val eventNo = deppLink.path!!.replace("/event/", "") } else { // handle } } .addOnFailureListener { // handle }
728x90
'개발 > Android' 카테고리의 다른 글
[Android] Dependency Injection vs Service Locator (0) | 2019.01.22 |
---|---|
[Android] Floating Button size (0) | 2019.01.17 |
[Android] TextInputLayout (0) | 2019.01.17 |
[Android] Kotlin - Realm (0) | 2019.01.11 |
[Android] Kotlin - Coroutine with Retrofit2 (0) | 2018.12.31 |
Comments