Advertisement
zombiek

Untitled

Dec 20th, 2022
1,357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.31 KB | None | 0 0
  1.     val build = FirebaseDynamicLinks.Builder(
  2.         GoogleNetHttpTransport.newTrustedTransport(), GsonFactory.getDefaultInstance(), GoogleCredential.fromStream(
  3.             """
  4.                
  5.            """.trimIndent().byteInputStream(),
  6.         ).createScoped(
  7.             setOf(
  8.                 "https://www.googleapis.com/auth/firebase"
  9.             )
  10.         )
  11.     )
  12.         .setApplicationName("streams")
  13.         .build()
  14.  
  15.     val createShortLinkRequest = CreateShortDynamicLinkRequest()
  16.  
  17.     val dynamicLinkInfo = DynamicLinkInfo()
  18.  
  19.     dynamicLinkInfo.domainUriPrefix = "https://livecommerceservice.page.link"
  20.     dynamicLinkInfo.link = "https://aa.ecomlive.tech/123"
  21.  
  22.     val androidInfo = AndroidInfo()
  23.     androidInfo.androidPackageName = "com.ya"
  24.     androidInfo.androidFallbackLink = "https://aa.ecomlive.tech/123"
  25.  
  26.     dynamicLinkInfo.androidInfo = androidInfo
  27.  
  28.     createShortLinkRequest.dynamicLinkInfo = dynamicLinkInfo
  29.  
  30.     val suffix = Suffix()
  31.     suffix.option = "SHORT"
  32.     createShortLinkRequest.suffix = suffix
  33.  
  34.     val request: FirebaseDynamicLinks.ShortLinks.Create =
  35.         build.shortLinks().create(createShortLinkRequest)
  36.     val createShortDynamicLinkResponse: CreateShortDynamicLinkResponse = request.execute()
  37.  
  38.     println(createShortDynamicLinkResponse.shortLink)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement