v4로부터의 마이그레이션 가이드

  1. 이전 플러그인 삭제
  2. 새 플러그인 초기화
  3. 딥링크 논리 업데이트
  4. 코드 업데이트

:경고: Unity v5로 마이그레이션할 때 주요 변경 사항이 있습니다. 여기에는 다음이 포함됩니다.

  • 새 클래스 이름
  • 새 안드로이드 패키지 이름
  • com.appsflyer.GetDeepLinkingActivity 은 Unity v5에 존재하지 않습니다. 이것은 딥링킹에 더 이상 필요하지 않습니다.
  • unity-jar-resolver을 사용하여 에셋을 가져옵니다.

이전 플러그인 삭제

  1. 다음 패키지에 포함된 모든 항목 삭제: AppsFlyerUnityPlugin_v4.x.x.unitypackage

다음은 포함된 모든 파일의 목록입니다.

Assets/Plugins/AppsFlyer.cs
Assets/Plugins/AFInAppEvents.cs
Assets/Plugins/AppsFlyerTrackerCallbacks.cs
---
Assets/Plugins/Android/AppsFlyerAndroidPlugin.jar 
Assets/Plugins/Android/AF-Android-SDK.jar 
Assets/Plugins/Android/installreferrer-1.0.aar
---
Assets/Plugins/iOS/AppsFlyerAppController.mm
Assets/Plugins/iOS/AppsFlyerCrossPromotionHelper.h
Assets/Plugins/iOS/AppsFlyerDelegate.h
Assets/Plugins/iOS/AppsFlyerDelegate.mm
Assets/Plugins/iOS/AppsFlyerLinkGenerator.h
Assets/Plugins/iOS/AppsFlyerShareInviteHelper.h
Assets/Plugins/iOS/AppsFlyerTracker.h
Assets/Plugins/iOS/AppsFlyerWrapper.h
Assets/Plugins/iOS/AppsFlyerWrapper.mm
Assets/Plugins/iOS/libAppsFlyerLib.a

새 플러그인 초기화

  1. 새 .unitypackage 추가, 새 플라그인에서 찾아볼 수 있습니다.
  2. 초기화에는 다음의 두 가지 기본 옵션이 있습니다.
    1. 이전 초기화 코드를 모두 삭제하고 새 .prefab 오브젝트 사용.
    2. 기존 초기화 코드 업데이트.

1. 이전 초기화 코드 모두 삭제

이를 위해 간단히 게임 오브젝트를 삭제하거나 또는 SDK가 초기화되는 게임 오브젝트에서 모든 앱플라이어 코드를 삭제합니다.
그런 다음 새 플러그인에 대해 초기화 가이드를 따르십시오.

2. 이전 초기화 코드를 새 코드로 업데이트

이전 초기화 코드를 다음 코드로 업데이트합니다.

void Start () {
    AppsFlyer.setAppsFlyerKey("K2***********99");
    /* AppsFlyer.setIsDebug(true); */
#if UNITY_IOS
  AppsFlyer.setAppID("41******85");
  AppsFlyer.trackAppLaunch();
  AppsFlyer.getConversionData();
#elif UNITY_ANDROID
  AppsFlyer.setAppID ("com.appsflyer.test");
  AppsFlyer.init("K2**********99","AppsFlyerTrackerCallbacks");
#endif
}

새 초기화 코드:

using AppsFlyerSDK;

public class AppsFlyerObjectScript : MonoBehaviour , IAppsFlyerConversionData
{
    void Start()
    {
        /* AppsFlyer.setDebugLog(true); */
        AppsFlyer.init-sdk("devkey", "appID", this);
        AppsFlyer.startSDK();
    }
    
 // .....   
}

중요 정보
변환 데이터 및/또는 딥링크도 구현하는 경우 다음을 사용하여 SDK를 초기화해야 합니다. IAppsFlyerConversionData 구현하면 됩니다.

딥링크 논리 업데이트

Unity v5는 다음을 포함하지 않습니다: com.appsflyer.GetDeepLinkingActivity.
이는 Unity v4에서 딥링크에 대한 해결 방법으로 사용되었습니다.

이 클래스를 딥링크에 사용하는 경우 AndroidManifest.xml 파일에서 GetDeepLinkingActivity를 삭제해야 합니다.

다른 코드 업데이트

다음은 모든 이전 API 및 새 API 목록입니다.

API

initSDK

// Old API's
AppsFlyer.setAppsFlyerKey(string key);
AppsFlyer.trackAppLaunch();
AppsFlyer.setAppID(string appleAppId);
AppsFlyer.getConversionData ();
AppsFlyer.init(string devKey);
AppsFlyer.init(string devKey, string callbackObject);
AppsFlyer.loadConversionData(string callbackObject);

// New API's
AppsFlyer.initSDK(string key, string app_id); // without deeplinking/conversion data
AppsFlyer.initSDK(string key, string app_id, MonoBehaviour gameObject); // with deeplinking/conversion data
AppsFlyer.startSDK();

변경되지 않은 API

AppsFlyer.setCurrencyCode(string currencyCode);
AppsFlyer.setCustomerUserID(string customerUserID);
AppsFlyer.setAdditionalData(Dictionary<string, string> extraData);
AppsFlyer.trackCrossPromoteImpression(string appId, string campaign);
AppsFlyer.setMinTimeBetweenSessions(int seconds);
AppsFlyer.setHost(string hostPrefixName, string hostName);
AppsFlyer.setUserEmails(EmailCryptType cryptType, params string[] userEmails);
AppsFlyer.setResolveDeepLinkURLs(params string[] userEmails);
AppsFlyer.setOneLinkCustomDomain(params string[] domains);
AppsFlyer.setIsDebug(bool isDebug);
AppsFlyer.getAppsFlyerId();
AppsFlyer.setAppInviteOneLinkID(string oneLinkID);

업데이트된 코어 API

// old
AppsFlyer.trackRichEvent(string eventName, Dictionary<string, string> eventValues);
// new
AppsFlyer.sendEvent(string eventName, Dictionary<string, string> eventValues);

// old
AppsFlyer.stopTracking(bool isStopTracking);
// new
AppsFlyer.stopSDK(bool isStopTracking);
   
// old   
AppsFlyer.setDeviceTrackingDisabled(bool state);
// new   
AppsFlyer.anonymizeUser(true);

// old 
AppsFlyer.generateUserInviteLink(Dictionary<string,string> parameters, string callbackObject,string callbackMethod, string callbackFailedMethod);
// new
AppsFlyer.generateUserInviteLink(Dictionary<string, string> parameters, MonoBehaviour gameObject);
    
// old 
AppsFlyer.trackAndOpenStore(string promotedAppId, string campaign, Dictionary<string,string> customParams);
// new 
AppsFlyer.trackAndOpenStore(string appID, string campaign, Dictionary<string, string> userParams, MonoBehaviour gameObject);

iOS 전용 API

// old
AppsFlyer.setIsSandbox(bool isSandbox);
// new
#if UNITY_IOS && !UNITY_EDITOR
        AppsFlyer.setUseReceiptValidationSandbox(true);
#endif

// old
AppsFlyer.registerUninstall(byte[] token);
// new
#if UNITY_IOS && !UNITY_EDITOR
        AppsFlyer.registerUninstall(token);
#endif

// old
AppsFlyer.handleOpenUrl(string url, string sourceApplication, string annotation);
// new
#if UNITY_IOS && !UNITY_EDITOR
        AppsFlyer.handleOpenUrl(string url, string sourceApplication, string annotation);
#endif

안드로이드 전용 API

// old
AppsFlyer.setCollectIMEI(bool shouldCollect);
// new 
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.setCollectIMEI(bool shouldCollect);
#endif

// old
AppsFlyer.setCollectAndroidID(bool shouldCollect);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.setCollectAndroidID(bool shouldCollect);
#endif

//old
AppsFlyer.setImeiData(string imeiData);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.setImeiData(string imeiData);
#endif

//old
AppsFlyer.updateServerUninstallToken(string token);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.updateServerUninstallToken(string token);
#endif

//old
AppsFlyer.setAndroidIdData(string androidIdData);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppAppsFlyersFlyerAndroid.setAndroidIdData("androidId");
#endif

//old
AppsFlyer.setPreinstallAttribution(string mediaSource, string campaign, string siteId);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.setPreinstallAttribution("mediaSource", "campaign", "siteId");
#endif

//old
AppsFlyer.handlePushNotification(Dictionary<string, string> payload);
//new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.handlePushNotifications();
#endif

Receipt 검증

// android old api
AppsFlyer.validate-receipt(string publicKey, string purchaseData, string signature, string price, string currency, Dictionary<string, string> extraParams);

 // iOS old api
AppsFlyer.validate-receipt(string productIdentifier, string price, string currency, string transactionId, Dictionary<string, string> additionalParametes);
AppsFlyer.createValidateInAppListener(string aObject, string callbackMethod, string callbackFailedMethod);  

// android new
#if UNITY_ANDROID && !UNITY_EDITOR
        AppsFlyer.validateAndSendInAppPurchase(
        "publicKey", 
        "signature", 
        "purchaseData", 
        "price", 
        "currency", 
        null, 
        this);
#endif

// ios new 
#if UNITY_IOS && !UNITY_EDITOR
        AppsFlyer.validateAndSendInAppPurchase(
        "productIdentifier", 
        "price", 
        "currency", 
        "tranactionId", 
        null, 
        this);
#endif

사용 중단

//@Deprecated
AppsFlyer.enableUninstallTracking(string senderId);
AppsFlyer.getHost();
AppsFlyer.loadConversionData(string callbackObject, string callbackMethod, string callbackFailedMethod);
AppsFlyer.setGCMProjectNumber(string googleGCMNumber);
AppsFlyer.setShouldCollectDeviceName(bool shouldCollectDeviceName);