# AppsFlyer
# Supported platfrom
- Android
- iOS
- Empty implement for OtherPlatform(Windows, Linux, ...)
# Plugin Architecture Implement
# How to use
- Init SDK
init appsflyer should be after game init and as early as possible.
setListener
should be called before init
.

this is a init sample code. we can know from the sample code:
- it's good
setListener
beforeinit
- must call
setAppID
andsetDevKey
- other
setXXX
api is optional.
following is callback sample code for argument of setListener

- Start AppsFlyer
you can start
appsflyer at any time. but i suggest you as early as possible.
setAppID
, setDevKey
, setDebug
, setCustomerUserID
should be called before start
.

- LogEvent/Other
you can call appsflyer(e.g. logEvent
, validateAndLogInAppPurchase
or other methods) at any time in your game.

- Stop
generally, you needn't call this. but if you want to stop appsflyer, you use this api.
# API
The api name of our plug-in is translated with appsflyer in blueprint.
// init unreal plugin
static void init();
// AppsFlyer listener
static void setListener(const FAppsFlyerCallback& callback);
// appID can get from appsflyer.com
static void setAppID(const FString& appID);
// devkey can get from appsflyer.com
static void setDevKey(const FString& devKey);
// if enable debug
static void setDebug(bool b);
static void setAdditionalData(const FString& json);
static void getAppsFlyerUID(const FAppsFlyerCallbackGetUID& cb);
static void setCustomerUserID(const FString& userID);
static void anonymizeUser(bool b);
static void collectASA(bool b);
static void waitForATTUserAuthorizationWithTimeoutInterval(int seconds);
static void stop();
static void start();
static void logEvent(const FString& evt, const FString& json);
static void useReceiptValidationSandbox(bool b);
/*
* validateAndLogInAppPurchase param need a json string, like follow sample.
*
* Android Params Sample:
* {
"publicKey": "xxx",
"signature": "xxx",
"purchaseData": "xxx",
"price": "xxx",
"currency": "xxx",
"parameters": {
"k1": "v1",
"k2": "v2"
}
}
*
* iOS Params Sample:
* {
"productIdentifier": "xxx",
"transactionId": "xxx",
"price": "xxx",
"currency": "xxx",
"parameters": {
"k1": "v1",
"k2": "v2"
}
* }
*
*/
static void validateAndLogInAppPurchase(const FString& purchaseJson);
static void setMinTimeBetweenSessions(int seconds);
static void setResolveDeepLinkURLs(const TArray<FString>& urls);
static void setImeiData(const FString& data);
static void setAndroidIdData(const FString& data);
static void setCollectIMEI(bool b);
static void setCollectAndroidID(bool b);
static void setCollectOaid(bool b);
# Sample Project Repo
this sample provide have three button for test.
- init button
test init appsflyer, and set properties for appsflyer.
In general, developers should call init at the start of the game.
- second button
test start appsflyer, appsflyer is real work (connect to appsflyer's server) after start
developers should call start after appsflyer init.
- third button
test stop appsflyer
developer needn't call stop, in most times.
# AppsFlyer Offical Document
AppsFlyer iOS Document: https://support.appsflyer.com/hc/en-us/articles/207032066-iOS-SDK-V6-X-integration-guide-for-developers#introduction
AppsFlyer Android Document: https://support.appsflyer.com/hc/en-us/articles/207032126-Android-SDK-integration-for-developers