Skip to content

Commit

Permalink
docs for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed Aug 23, 2022
1 parent c42205d commit 557746d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 45 deletions.
86 changes: 42 additions & 44 deletions Docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
The list of available methods for this plugin is described below.
- [Android & iOS APIs](#allAPI)
- [initSDK](#initSDK)
- [startSdk](#startSdk)
- [logEvent](#logEvent)
- [setCustomerUserId](#setCustomerUserId)
- [stop](#stop)
Expand All @@ -30,7 +31,6 @@ The list of available methods for this plugin is described below.
- [setCollectAndroidID](#setCollectAndroidID)
- [setCollectIMEI](#setCollectIMEI)
- [setDisableNetworkData](#setDisableNetworkData)
- [startSdk](#startSdk)
- [performOnDeepLinking](#performOnDeepLinking)
- [iOS Only APIs](#iOSOnly)
- [disableCollectASA](#disableCollectASA)
Expand Down Expand Up @@ -81,7 +81,7 @@ appsFlyer.initSdk(
appId: '41*****44',
onInstallConversionDataListener: false, //Optional
onDeepLinkListener: true, //Optional
timeToWaitForATTUserAuthorization: 10 //for iOS 14.5
timeToWaitForATTUserAuthorization: 10, //for iOS 14.5
manualStart: true, //Optional, take effect only on Android
},
(res) => {
Expand All @@ -92,6 +92,44 @@ appsFlyer.initSdk(
}
);
```

---

##### <a id="startSdk"> **`startSdk()`**

In version 6.9.0 of the react-native-appslfyer SDK we added the option of spliting between the initialization stage and start stage. You just need to add the property `manualStart: true` to the init object, and later call `appsFlyer.startSdk()` whenever you descide. If this property is set to `false` or doesn't exist the sdk will start after calling `appsFlyer.initSdk(...)`.

*Example:*
```javascript
const option = {
isDebug: true,
devKey: 'UsxXxXxed',
appId: '75xXxXxXxXx11',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 5,
manualStart: true, // <--- for manual start.
};

appsFlyer.initSdk(
option,
() => {
if (!option.manualStart) {
console.warn('AppsFlyer SDK started!');
} else {
console.warn('AppsFlyer SDK init, didn\'t send launch yet');
}
},
err => {
// handle error
},
);
//...
// app flow
//...

appsFlyer.startSdk(); // <--- Here we send launch
```
---

##### <a id="logEvent"> **`logEvent(eventName, eventValues, success, error)`**
Expand Down Expand Up @@ -723,44 +761,6 @@ appsFlyer.setDisableNetworkData(true);
}
```

##### <a id="startSdk"> **`startSdk()`**

In version 6.9.0 of the react-native-appslfyer SDK we added the option of spliting between [init](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerlib#init) and [start](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerlib#start) of the *Android* sdk. You just need to add the property `manualStart: true` to the init object, and later call `appsFlyer.startSdk()` whenever you descide. If this property is set to `false` or doesn't exist the sdk will start after calling `appsFlyer.initSdk(...)`<br>
`manualStart` property will not effect the behavior of the iOS app! for iOS the sdk will start after the call of `appsFlyer.initSdk(...)`

*Example:*
```javascript
const option = {
isDebug: true,
devKey: 'UsxXxXxed',
appId: '75xXxXxXxXx11',
onInstallConversionDataListener: true,
onDeepLinkListener: true,
timeToWaitForATTUserAuthorization: 5,
manualStart: true, // <--- for manual start.
};

appsFlyer.initSdk(
option,
() => {
if (!option.manualStart || Platform.OS != 'android') {
console.warn('AppsFlyer SDK started!');
} else {
console.warn('AppsFlyer SDK init, didn\'t send launch yet');
}
},
err => {
// handle error
},
);
//...
// app flow
//...
if (Platform.OS == 'android') {
appsFlyer.startSdk(); // <--- Here we send launch
}
```

##### <a id="performOnDeepLinking"> **`performOnDeepLinking()`**

Enables manual triggering of deep link resolution. This method allows apps that are delaying the call to `appsFlyer.startSdk()` to resolve deep links before the SDK starts.
Expand All @@ -786,7 +786,7 @@ const onDeepLink = appsFlyer.onDeepLink(res => {
appsFlyer.initSdk(
option,
() => {
if (!option.manualStart || Platform.OS != 'android') {
if (!option.manualStart) {
console.warn('AppsFlyer SDK started!');
} else {
console.warn('AppsFlyer SDK init, didn\'t send launch yet');
Expand All @@ -805,9 +805,7 @@ if (Platform.OS == 'android' && isAppOpenedFromDeeplink) {

// more app flow...

if (Platform.OS == 'android') {
appsFlyer.startSdk(); // <--- Here we send launch
}
appsFlyer.startSdk(); // <--- Here we send launch
```
## <a id="iOSOnly"> iOS Only APIs

Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ declare module "react-native-appsflyer" {
setSharingFilterForPartners(partners: string[]): void
setPartnerData(partnerId: string, partnerData: object): void
appendParametersToDeepLinkingURL(contains: string, parameters: object): void
startSdk(): void

/**
* For iOS Only
Expand All @@ -158,7 +159,6 @@ declare module "react-native-appsflyer" {
setCollectIMEI(isCollect: boolean, successC?: SuccessCB): void
setCollectAndroidID(isCollect: boolean, successC?: SuccessCB): void
setDisableNetworkData(disable: boolean): void
startSdk(): void
performOnDeepLinking(): void
};

Expand Down

0 comments on commit 557746d

Please sign in to comment.