main.com.wisetrack.sdk.WiseTrackReferrerReceiver.kt Maven / Gradle / Ivy
The newest version!
package com.wisetrack.sdk
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.wisetrack.sdk.Constants.Companion.REFERRER
/**
@author hamed (@hamed-hsb)
* @since 19th October 2021
*
* support multiple BroadcastReceivers for the INSTALL_REFERRER:
* https://appington.wordpress.com/2012/08/01/giving-credit-for-android-app-installs/
*
* You should capture the Google Play Store `INSTALL_REFERRER` intent with a broadcast receiver.
* If you are **not using your own broadcast receiver** to receive the `INSTALL_REFERRER` intent,
* add the following `receiver` tag inside the `application` tag in your `AndroidManifest.xml`.
*
*
*
*
*
*
*/
class WiseTrackReferrerReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
val rawReferrer = intent!!.getStringExtra(REFERRER) ?: return
WiseTrack.getDefaultInstance().sendReferrer(rawReferrer, context)
}
}