Testing referrals
For this you need two devices. Let’s call them Sender and Receiver. If you have your app installed already, please delete it from both devices. Note that the events will not trigger if you use the same device for both Sender and Receiver.
Sender | Receiver |
---|---|
Follow the Quickstart guide and build the app to this device. | |
Run the app and share a link to Receiver. | |
Add `Megacool.getInstance()?.resetIdentity()` before `Megacool.start()`. This will reset the device identity, so it acts as a new device every time the app starts. Remember to remove this after you’re done testing. | |
Connect this device to your computer and run the following in the terminal, to simulate a new Google Play install: `adb shell am broadcast -a "com.android.vending.INSTALL_REFERRER" --es referrer '?_m=REFERRAL_CODE' ""`. Replace `REFERRAL_CODE` with the `_m` parameter value from your shared link. | |
Build and run the app. Now this device will receive the `ReceivedShareOpenedEvent` event with `event.isFirstSession == true` and generate a new install. | |
Press the home button and re-open the app to instantly receive the `SentShareOpenedEvent` event, like shown in the Quickstart guide. |