Android InstallReferrerClient - obtaining custom PlayStore listing url

34 views Asked by At

I have an app in Google Play together with custom store listing The url is as follows

https://play.google.com/store/apps/details?id=[My App ID]&listing=[custom_listing]

Now I want to know in my application the value of listing param. I tried to use InstallReferrerClient as below, but at any time I wasn't able to get the correct url. It was always without listing param.

referrerClient.startConnection(object : InstallReferrerStateListener {
        override fun onInstallReferrerSetupFinished(responseCode: Int) {
            when (responseCode) {
                InstallReferrerClient.InstallReferrerResponse.OK -> {
                    // Connection established.
                    val details = referrerClient.installReferrer
                    referrerDetails = referrerClient.installReferrer
                    val referrerUrl: String = details.installReferrer
                    val referrerClickTime: Long = details.referrerClickTimestampSeconds
                    val appInstallTime: Long = details.installBeginTimestampSeconds
                    val instantExperienceLaunched: Boolean = details.googlePlayInstantParam

                    Toast.makeText(context, referrerUrl, Toast.LENGTH_LONG).show()
                }
                InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> {
                    // API not available on the current Play Store app.
                }
                InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> {
                    // Connection couldn't be established.
                }
            }
        }

        override fun onInstallReferrerServiceDisconnected() {
            // Try to restart the connection on the next request to
            // Google Play by calling the startConnection() method.
        }
    })
0

There are 0 answers