0

postInstallIntent lose bundle extras after installation. I create postInstallIntent this way:

val intent: Intent?
intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.test.ru/activity/main/"))
intent.setPackage(context.packageName)
intent.addCategory(Intent.CATEGORY_BROWSABLE)
intent?.putExtra(EXTRA_FIRST, data1)
intent?.putExtra(EXTRA_SECOND, data2)  

Than call it:

InstantApps.showInstallPrompt(
                activity,
                intent,
                REQUEST_CODE,
                INSTALL_REFERRER
        )

It opens requested activity, but when I try to get data from intent intent.extras in installed app the bundle is empty.

What am I doing wrong or it's a problem of showInstallPrompt?

1 Answers1

0

I understood that you want to pass data from your Instant app to the installed app and this could happen in the following ways as the support from Android documentation:

  1. For Android 8.0 (API level 26) and higher, you can use the Cookie API sample app
  2. For Android 7.1 (API level 25) and lower, you can use Storage API sample app

For more details see these references:

https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle

How can I restore data from instant app to installed app?

How to transfer the shared prefs from Instant app to full app How to store data in android instant app and restore it in installed app

Now, in my case, I am using the normal function to open the installed version of the app by using the following function

private fun showInstallPrompt() {
        val postInstall = Intent(Intent.ACTION_MAIN)
            .addCategory(Intent.CATEGORY_DEFAULT)
            .setPackage(packageName)
        InstantApps.showInstallPrompt(this@MainActivity, postInstall, 0, null)
    }