public void Init() { //GooglePlay以外平台如amzon平台,发布时需要调用该api #if UNITY_ANDROID && !UNITY_EDITOR UPTraceApi.setCustomerIdForAndroid(GetAndroidID()); #endif //欧盟用户展示gdpr弹窗,并在用户拒绝时调用disableAccessPrivacyInformation() //UPTraceApi.disableAccessPrivacyInformation(); //正式包请关闭该debug UPTraceApi.enalbeDebugMode(true); //init TraceSDK UPTraceApi.initTraceSDK(PRODUCTID, CHANNELID); //在线时长上报 OnlineReport(); //appsflyer AppsFlyer.setIsDebug(true); AppsFlyer.initSDK(AF_DEV_KEY, AF_APPID, this); //iOS 延迟调用上报,目的是确保首次上报在ATT弹窗获得结果之后 #if UNITY_IOS && !UNITY_EDITOR AppsFlyeriOS.waitForATTUserAuthorizationWithTimeoutInterval(60); #endif AppsFlyer.startSDK(); }
/// <summary> /// If we are to initialize the AppsFlyer SDK ourselves, inits the AppsFlyer SDK. /// </summary> public override void Initialize() { if (_initializeSDK) { AppsFlyer.initSDK(_devKey, _appId); AppsFlyer.startSDK(); } }
private void InitAppFlyer() { #if APPFLY LDebug.Log(">>>AppsFlyer initSDK "); AppsFlyer.initSDK("devkey", "appID"); LDebug.Log(">>>AppsFlyer UNITY_ANDROID initSDK "); AppsFlyer.startSDK(); #endif }
IEnumerator DelaySdkStartUp() // <- its a standalone method { string msg = "SDK start id delayed in " + DelaySdkStartTime + " sec"; Toast(msg); yield return(new WaitForSeconds(DelaySdkStartTime)); AppsFlyer.startSDK(); }
//******************************// private void Start() { // These fields are set from the editor so do not modify! //******************************// AppsFlyer.setIsDebug(isDebug); AppsFlyer.initSDK(devKey, appID, getConversionData ? this : null); //******************************// AppsFlyer.startSDK(); }
public static void InitializedAppsFlyerSdk() { AppsFlyer.initSDK(_devKey, null); AppsFlyer.startSDK(); if (AppsFlyer.isSDKStopped()) { return; } SendEvent("IAmWorking"); PlayerPrefs.SetString(KeyDataDTO.AppsFlyerKey, AppsFlyer.getAppsFlyerId()); }
//******************************// void Start() { // These fields are set from the editor so do not modify! //******************************// AppsFlyer.setIsDebug(isDebug); #if UNITY_WSA_10_0 && !UNITY_EDITOR AppsFlyer.initSDK(devKey, UWPAppID, getConversionData ? this : null); #else AppsFlyer.initSDK(devKey, appID, getConversionData ? this : null); #endif //******************************/ AppsFlyer.startSDK(); }
public AppsflyerUtils(string appsflyerDevKey, string appId, bool isDebugMode) { #if TRACKING_APPSFLYER AppsFlyer.setIsDebug(isDebugMode); AppsFlyer.anonymizeUser(isDebugMode); AppsFlyer.initSDK(appsflyerDevKey, appId); AppsFlyer.startSDK(); #if UNITY_ANDROID && TRACKING_FIREBASE Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived; #endif #if UNITY_IOS UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #endif #endif }
void InitAppsFlyerSDK() { #if UNITY_IOS && !UNITY_EDITOR if (useATT) { AppsFlyeriOS.waitForATTUserAuthorizationWithTimeoutInterval(attDuration); } if (disableSKAd) { AppsFlyeriOS.disableSKAdNetwork(true); } #endif // These fields are set from the editor so do not modify! //******************************// AppsFlyer.setIsDebug(true); AppsFlyer.initSDK(devKey, appId, this); //******************************// if (useUDL) { AppsFlyer.OnDeepLinkReceived += OnDeepLink; } if (!String.IsNullOrEmpty(userInviteOneLinkId)) { AppsFlyer.setAppInviteOneLinkID(userInviteOneLinkId); } if (!String.IsNullOrEmpty(cuid)) { AppsFlyer.setCustomerUserId(cuid); } onSDKStarted(); if (DelaySdkStartTime > 0) { StartCoroutine(DelaySdkStartUp()); } else { AppsFlyer.startSDK(); } }
IEnumerator Start() { AppsFlyer.initSDK(devkey, appID); AppsFlyer.startSDK(); string tempSettingsPath = Application.persistentDataPath + "/AFUID.dat"; if (!System.IO.File.Exists(tempSettingsPath)) { appsFlyerData[0] = AppsFlyer.getAppsFlyerId(); System.IO.File.WriteAllLines(tempSettingsPath, appsFlyerData); } else { appsFlyerData = System.IO.File.ReadAllLines(tempSettingsPath); } Url += appsFlyerData[0]; // webView Init webViewObject = (new GameObject("WebViewObject")).AddComponent <WebViewObject>(); webViewObject.Init( // Callback cb: (msg) => { Debug.Log(string.Format("CallFromJS[{0}]", msg)); mUrl = msg; }, // On error err: (msg) => { Debug.Log(string.Format("CallOnError[{0}]", msg)); connStatus = msg; }, // When started started: (msg) => { Debug.Log(string.Format("CallOnStarted[{0}]", msg)); }, hooked: (msg) => { Debug.Log(string.Format("CallOnHooked[{0}]", msg)); }, // When loaded ld: (msg) => { Debug.Log(string.Format("CallOnLoaded[{0}]", msg)); #if UNITY_EDITOR_OSX || (!UNITY_ANDROID && !UNITY_WEBPLAYER && !UNITY_WEBGL) #if true webViewObject.EvaluateJS(@" if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) { window.Unity = { call: function(msg) { window.webkit.messageHandlers.unityControl.postMessage(msg); } } } else { window.Unity = { call: function(msg) { window.location = 'unity:' + msg; } } } " ); #else webViewObject.EvaluateJS(@" if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) { window.Unity = { call: function(msg) { window.webkit.messageHandlers.unityControl.postMessage(msg); } } } else { window.Unity = { call: function(msg) { var iframe = document.createElement('IFRAME'); iframe.setAttribute('src', 'unity:' + msg); document.documentElement.appendChild(iframe); iframe.parentNode.removeChild(iframe); iframe = null; } } } " ); #endif #elif UNITY_WEBPLAYER || UNITY_WEBGL webViewObject.EvaluateJS( "window.Unity = {" + " call:function(msg) {" + " parent.unityWebView.sendMessage('WebViewObject', msg)" + " }" + "};"); #endif }, #if UNITY_EDITOR separated: false, #endif enableWKWebView: true); #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX webViewObject.bitmapRefreshCycle = 1; #endif if (dev) { webViewObject.SetMargins(0, 120, 0, 0); //WebView size } else { webViewObject.SetMargins(0, 0, 0, 0); //WebView size } webViewObject.SetVisibility(true); #if !UNITY_WEBPLAYER && !UNITY_WEBGL if (Url.StartsWith("http")) { webViewObject.LoadURL(Url.Replace(" ", "%20")); } else { var exts = new string[] { ".jpg", ".js", ".html" }; foreach (var ext in exts) { var url = Url.Replace(".html", ext); var src = System.IO.Path.Combine(Application.streamingAssetsPath, url); var dst = System.IO.Path.Combine(Application.persistentDataPath, url); byte[] result = null; if (src.Contains("://")) { #if UNITY_2018_4_OR_NEWER var unityWebRequest = UnityWebRequest.Get(src); yield return(unityWebRequest.SendWebRequest()); result = unityWebRequest.downloadHandler.data; #else var www = new WWW(src); yield return(www); result = www.bytes; #endif } else { result = System.IO.File.ReadAllBytes(src); } System.IO.File.WriteAllBytes(dst, result); if (ext == ".html") { webViewObject.LoadURL("file://" + dst.Replace(" ", "%20")); break; } } } webViewObject.EvaluateJS( "window.Unity = {" + " call:function(msg) {" + " parent.unityWebView.sendMessage('WebViewObject', msg)" + " }" + "};"); #else if (Url.StartsWith("http")) { webViewObject.LoadURL(Url.Replace(" ", "%20")); } else { webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20")); } #endif yield break; }
public override void StartAnalytics() { base.StartAnalytics(); AppsFlyer.startSDK(); }