-
Notifications
You must be signed in to change notification settings - Fork 398
/
DynamicLinksUtil.kt
34 lines (27 loc) · 1.17 KB
/
DynamicLinksUtil.kt
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
package com.google.firebase.dynamicinvites.kotlin.util
import android.net.Uri
import com.google.firebase.dynamicinvites.kotlin.model.InviteContent
import com.google.firebase.dynamiclinks.DynamicLink
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks
object DynamicLinksUtil {
fun generateInviteContent(): InviteContent {
return InviteContent(
"Hey check out my great app!",
"It's like the best app ever.",
generateContentLink())
}
// [START ddl_generate_content_link]
fun generateContentLink(): Uri {
val baseUrl = Uri.parse("https://your-custom-name.page.link")
val domain = "https://your-app.page.link"
val link = FirebaseDynamicLinks.getInstance()
.createDynamicLink()
.setLink(baseUrl)
.setDomainUriPrefix(domain)
.setIosParameters(DynamicLink.IosParameters.Builder("com.your.bundleid").build())
.setAndroidParameters(DynamicLink.AndroidParameters.Builder("com.your.packageName").build())
.buildDynamicLink()
return link.uri
}
// [END ddl_generate_content_link]
}