You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No manual linking needed (auto-linked). The library adds `com.android.installreferrer:installreferrer:2.2` to your Android build automatically via `build.gradle`.
19
+
No manual linking needed (auto-linked). The library adds `com.android.installreferrer:installreferrer:2.2` to your Android build automatically.
20
20
21
21
Make sure Google Play Store is installed on the test device — the API is backed by a Play Store service.
22
22
23
23
### iOS
24
24
25
-
No additional setup needed. All methods return `null` on iOS. Check for `null` before using results.
25
+
No additional setup needed. All methods return `null` on iOS. Always null-check before using results.
Clears the in-memory cache so the next call to `getInstallReferrer` or `getReferrerDetails` fetches fresh data from native. Useful in tests.
109
-
110
-
---
111
-
112
104
## Error Codes
113
105
114
-
When a native call fails, the Promise is rejected with an `Error` whose `code`property is one of:
106
+
When a native call fails the Promise is rejected. The error `code`will be one of:
115
107
116
108
| Code | Cause |
117
109
|---|---|
118
-
|`SERVICE_UNAVAILABLE`| Play Store is not installed, or the referrer service is unavailable / disconnected |
110
+
|`SERVICE_UNAVAILABLE`| Play Store is not installed, or the referrer service disconnected |
119
111
|`FEATURE_NOT_SUPPORTED`| The installed Play Store version does not support the Install Referrer API |
120
112
|`UNKNOWN_ERROR`| An unexpected response code was returned |
121
113
122
114
```ts
123
115
try {
124
116
const referrer =awaitgetInstallReferrer();
125
-
} catch (e) {
126
-
if ((easany).code==='SERVICE_UNAVAILABLE') {
127
-
//Handle gracefully — e.g. sideloaded APK, non-Play device
117
+
} catch (e:any) {
118
+
if (e.code==='SERVICE_UNAVAILABLE') {
119
+
//Sideloaded APK or non-Play device — handle gracefully
128
120
}
129
121
}
130
122
```
@@ -133,26 +125,16 @@ try {
133
125
134
126
## Android Notes
135
127
136
-
- The referrer string is set by Google Play at install time and is only available for **90 days** after installation.
137
-
- Sideloaded APKs (not installed via Play Store) will receive an empty referrer string.
138
-
-The API requires the device to have Google Play Services installed.
139
-
-Timestamps returned by the native API are in **seconds**; this library converts them to **milliseconds**for JavaScript consistency.
128
+
- The referrer string is available for **90 days** after installation.
129
+
- Sideloaded APKs (not installed via Play Store) will return an empty referrer string.
130
+
-Requires Google Play Store to be installed on the device.
131
+
-The native API returns timestamps in **seconds** — this library converts them to **milliseconds**so `new Date(clickTimestamp)` works directly.
140
132
141
133
---
142
134
143
135
## iOS Limitation
144
136
145
-
Google Play Install Referrer is an Android-only API. There is no equivalent mechanism on iOS. All methods in this library resolve with `null` on iOS. To attribute iOS installs, use the [SKAdNetwork API](https://developer.apple.com/documentation/storekit/skadnetwork) or a third-party attribution SDK.
146
-
147
-
---
148
-
149
-
## Example App
150
-
151
-
See [example/src/App.tsx](example/src/App.tsx) for a complete working example that:
152
-
153
-
- Fetches the referrer string and full details on mount
154
-
- Displays click/install timestamps as ISO date strings
155
-
- Renders parsed UTM parameters in a list
137
+
Google Play Install Referrer is an Android-only API. All methods in this library resolve with `null` on iOS. For iOS install attribution, refer to [SKAdNetwork](https://developer.apple.com/documentation/storekit/skadnetwork) or a third-party attribution SDK.
0 commit comments