I am trying to set up dynamic links so that a link will deep link the user to the app if they already have it installed and the play store if they don't. I expect the link to survive the play store installation process and be sent to the launcher activity with the link. The dynamic link works when the app is already installed. However, when the app is not installed, it sends the user to the play store but the dynamic link does not survive the installation process. I have read that the "Open" button is supposed to change to "Continue" when the user is sent to the play store with a dynamic link, but when I do it, it still says "Open". Here is my activity in AndroidManifest.xml.
<activity android:name=".share.DeepLinkActivity"
android:theme="@style/AppTheme"
>
<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:host="housebook.com"
android:scheme="https"/>
<data
android:host="housebook.com"
android:scheme="http"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="housebook.page.link"
android:scheme="https"/>
<data
android:host="housebook.page.link"
android:scheme="http"/>
</intent-filter>
</activity>
Here is my DeepLinkActivity
package chenige.chkchk.wairz.share
import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
import chenige.chkchk.wairz.BaseActivity
import chenige.chkchk.wairz.landing.LandingActivity
import chenige.chkchk.wairz.model.ShareDeepLink
import chenige.chkchk.wairz.sign_in.SignInActivity
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks
class DeepLinkActivity : BaseActivity() {
companion object {
const val SHARE_DEEP_LINK = "SHARE_DEEP_LINK"
}
var mAuth = FirebaseAuth.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if(intent.data != null){
FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener { pendingDynamicLinkData ->
if(pendingDynamicLinkData != null) {
val houseId = pendingDynamicLinkData.link!!.getQueryParameter("House")
val shareId = pendingDynamicLinkData.link!!.getQueryParameter("Share")
goIntoAppWithShare(houseId!!, shareId!!)
}else{
goIntoApp()
}
}.addOnFailureListener {failure ->
showErrorRetrievingLink(failure.message!!)
}
}else{
goIntoApp()
}
}
fun goIntoAppWithShare(houseId: String, shareId: String){
val intent : Intent
if (mAuth.currentUser != null) {
intent = Intent(this, LandingActivity::class.java)
}else{
intent = Intent(this, SignInActivity::class.java)
}
intent.putExtra(SHARE_DEEP_LINK, ShareDeepLink(houseId, shareId))
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
finish()
}
fun goIntoApp(){
val intent : Intent
if (mAuth.currentUser != null) {
intent = Intent(this, LandingActivity::class.java)
}else{
intent = Intent(this, SignInActivity::class.java)
}
startActivity(intent)
finish()
}
fun showErrorRetrievingLink(error: String) {
val dialog = AlertDialog.Builder(this).setTitle("Error Retrieving House").setMessage("HouseBook has had an issue retrieving the shared house.")
.setPositiveButton("Ok.") { dialog, i ->
goIntoApp()
}
dialog.show()
}
}
I have added a dynamic link in the Firebase console as https://housebook.page.link
I have added a 256 SHA certificate fingerprint.
A link that I expect to work but does not is https://housebook.page.link/nvfVf7N91D7dgBLV7
Debugging with https://housebook.page.link/nvfVf7N91D7dgBLV7?d=1 shows just one warning about phishing. I have tried adding a configuration to make this warning go away, but it does not help. Does anybody know why the link is not surviving the installation process? I have been struggling with this for like 2 weeks now.