You can use the Google Play Store's Install Referrer API to securely retrieve referral content from Google Play, such as:
- The referrer URL of the installed package.
- The timestamp, in seconds, of when a referrer click happened.
- The timestamp, in seconds, of when an installation began.
The Install Referrer API is exposed by the Google Play Store app on a device. Devices with a Google Play app version of 8.3.73 or later automatically have access to the API.
You must also have a Google Play Console account to use the Install Referrer API.
Using the API
The Install Referrer API is implemented as an Android Interface Definition Language (AIDL) interface.