Guide de migration depuis la v4
- Suppression de l'ancien plugin
- Initialisation du nouveau plugin
- Mise à jour de la logique de deep linking
- Mise à jour du code
⚠️ There are breaking changes when migrating to Unity v5. This includes:
- Nouveaux noms de classe
- Nouveau nom de package Android
com.appsflyer.GetDeepLinkingActivity
n'existe pas dans Unity v5. Ce n'est plus nécessaire pour le deeplinking.- unity-jar-resolver est utilisé pour importer les actifs
Suppression de l'ancien plugin
- Supprimez tous les éléments contenus dans
AppsFlyerUnityPlugin_v4.x.x.unitypackage
Voici une liste de tous les fichiers inclus :
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
Initialiser le nouveau plugin
- Ajoutez le nouveau .unitypackage, qui se trouve dans le nouveau plugin.
- Il existe deux options principales d'initialisation :
- Supprimez tout de l'ancien code init et utilisez le nouvel objet .prefab .
- Mettez à jour votre code init existant.
1. Suppression de l'ancien code init
Il suffit de supprimer le game object ou la totalité du code appsflyer dans le game object où le SDK est initialisé.
Suivez ensuite le guide d'installation du nouveau plugin.
2. Mise à jour de l'ancien code init
Remplacez l'ancien code init :
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
}
Par le nouveau code init :
using AppsFlyerSDK;
public class AppsFlyerObjectScript : MonoBehaviour , IAppsFlyerConversionData
{
void Start()
{
/* AppsFlyer.setDebugLog(true); */
AppsFlyer.init-sdk("devkey", "appID", this);
AppsFlyer.startSDK();
}
// .....
}
Important
Si vous implémentez également des données de conversion et/ou des deep linking, vous devez initialiser le SDK avec IAppsFlyerConversionData
comme interface.
Mise à jour de la logique de deep linking
Unity v5 n'inclut pas com.appsflyer.GetDeepLinkingActivity
.
Ceci a été utilisé dans Unity v4 comme solution de contournement pour le deeplinking.
Si vous utilisez cette classe pour le deeplinking, supprimez l'activité GetDeepLinkingActivity du fichier AndroidManifest.xml.
Mise à jour d'autres codes
Voici une liste de toutes les anciennes API, et des nouvelles API.
API
- setAppsFlyerKey
- trackAppLaunch
- setAppID
- getConversionData
- init
- loadConversionData
- setCurrencyCode
- Définir l'ID Utilisateur-Client
- setAdditionalData
- trackCrossPromoteImpression
- setMinTimeBetweenSessions
- setHost
- setUserEmails
- setResolveDeepLinkURLs
- setOneLinkCustomDomain
- trackRichEvent
- stopTracking
- setIsDebug
- getAppsFlyerId
- setDeviceTrackingDisabled
- setAppInviteOneLinkID
- generateUserInviteLink
- trackAndOpenStore
- setIsSandbox
- registerUninstall
- setCollectIMEI
- setCollectAndroidID
- setImeiData
- updateServerUninstallToken
- setAndroidIdData
- setPreinstallAttribution
- validate-receipt (ios)
- validate-receipt (android)
- createValidateInAppListener
- handlePushNotification
- enableUninstallTracking
- handleOpenUrl
- getHost
- loadConversionData
- setGCMProjectNumber
- setShouldCollectDeviceName
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 inchangées
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 majeures mises à jour
// 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);
API iOS uniquement
// 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 Android uniquement
// 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
Validation de la réception
// 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
Obsolète
//@Deprecated
AppsFlyer.enableUninstallTracking(string senderId);
AppsFlyer.getHost();
AppsFlyer.loadConversionData(string callbackObject, string callbackMethod, string callbackFailedMethod);
AppsFlyer.setGCMProjectNumber(string googleGCMNumber);
AppsFlyer.setShouldCollectDeviceName(bool shouldCollectDeviceName);
Mis(e) à jour il y a 12 mois