I’m need to get GCLID inside my android app

I’m need to get GCLID value inside my android app. What i found is Play Install Referrer Library, that returns me a utm tags, but i’m not sure that GCLID value will be inside val referrer = response.installReferrer

Code sample:

 fun getGCLID(){
        referrerClient = InstallReferrerClient.newBuilder(this).build()
        referrerClient.startConnection(object : InstallReferrerStateListener {

            override fun onInstallReferrerSetupFinished(responseCode: Int) {
                when (responseCode) {
                    InstallReferrerClient.InstallReferrerResponse.OK -> {
                        // Connection established.
                        val response: ReferrerDetails = referrerClient.installReferrer
                        val referrer = response.installReferrer
                        val clickTimestamp = response.referrerClickTimestampSeconds
                        val installTimestamp = response.installBeginTimestampSeconds
                        Log.d("TagGCLID", "onInstallReferrerSetupFinished: 1")
                        if ("gclid" in referrer) {
                            Log.d("TagGCLID", "GCLID is detected in referrer // is $referrer")
                            //report to Firebase Analytics
                        } else {
                            Log.d("TagGCLID", "no GCLID is detected in referrer\n" +
                            //do something else
                    InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> {
                        Log.d("TagGCLID", "InstallReferrerResponse: -1")
                        // API not available on the current Play Store app.
                    InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> {
                        Log.d("TagGCLID", "InstallReferrerResponse: -2")
                        // Connection couldn't be established.

            override fun onInstallReferrerServiceDisconnected() {
                Log.d("TagGCLID", "onInstallReferrerServiceDisconnected: -3")
                // Try to restart the connection on the next request to
                // Google Play by calling the startConnection() method.

What i’m suppose to do to get GCLID value?

%d bloggers like this: