Example #1
0
 public AppLifeCycleResumeState OnResume()
 {
     if (_sm.NativePsdkStarted)
     {
         return(_impl.OnResume());
     }
     else
     {
         return(AppLifeCycleResumeState.ALCRS_NONE);
     }
 }
Example #2
0
        /// <summary>
        /// <summary>_analyticsService
        /// Setup the specified store, domain, language and orientation.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="domain">Domain.</param>
        /// <param name="language">Language.</param>
        /// <param name="orientation">Orientation.</param>
        public bool Setup(string language = null, string configJson = null)
        {
            if (_psdkSetup)
            {
                return(true);
            }
            _psdkSetup = true;

            PsdkEventSystem.Instance.Init();

            _configJson = configJson;

            LogPsdkVersions();

            if (System.String.IsNullOrEmpty(_configJson))
            {
                Debug.Log("Reading psdk json configuration from steamingAssets/psdk.json file !");
                _configJson = PsdkUtils.ReadPsdkConfigFromFile();
            }

            if (System.String.IsNullOrEmpty(_configJson))
            {
                Debug.LogError("Null or empty psdk configuration json, please put it in Assets/SteamingAssets/psdk.json !");
                return(false);
            }

            PsdkUtils.NativeLog("psdk config: " + _configJson);
            LocalConfig = new PsdkLocalConfig(_configJson);

            if (LocalConfig.GetBool(new string[] { "appsFlyer", "included" }, false) && LocalConfig.GetBool(new string[] { "singular", "included" }, false))
            {
                Debug.LogError("appsFlyer and singluar are both included. this is not allowed. build will fail.");
            }

            DebugMode = isDebugMode(_configJson);

            RunObbDownloaderIfNeeded();

            SetupAppLifecycleManager();
            // initial analytics listner

            PsdkEventSystem.Instance.Init();

            if (!SetupCrossDevicePersistency())
            {
                Debug.Log("CrossDevicePersistency not initialized !");
            }

            if (!SetupBilling())
            {
                Debug.Log("Billing not initialized !");
            }

            if (!SetupRateUs())
            {
                Debug.Log("RateUs not initialized !");
            }

            if (!SetupShare())
            {
                Debug.Log("Share not initialized !");
            }

            if (!SetupSocial())
            {
                Debug.Log("Social not initialized !");
            }


            if (!SetupAudience())
            {
                Debug.Log("PSDK Audience not initialized!");
            }

            if (!SetupInAppPurchase())
            {
                Debug.Log("PSDK InAppPurchase not initialized!");
            }

            if (!SetupExternalConfiguration())
            {
                Debug.Log("PSDK External Configuration not initialized!");
            }

            if (!SetupAnalyticsService())
            {
                Debug.Log("PSDK Analytics not inititalized  !");
            }

            if (!SetupLocationManagerService())
            {
                Debug.Log("location manager not inititalized  !");
            }

            if (!SetupRewardedAdsService())
            {
                Debug.Log("RewardedAds not initialized !");
            }

            if (!SetupGameLevelData())
            {
                Debug.Log("GLD not initialized !");
            }

            if (!SetupSplash())
            {
                Debug.Log("Splash not initialized !");
            }

            if (!SetupBanners())
            {
                Debug.Log("Banners not initialized !");
            }

            if (!SetupCrashMonitoringTool())
            {
                Debug.Log("CrashMonitoringTool not initialized !");
            }

            if (!SetupNativeCampaign())
            {
                Debug.Log("NativeCampaign not initialized !");
            }

            if (!SetupSingular())
            {
                Debug.Log("Singular not initialized !");
            }


//			string newConfigJson = preProcessConfigJsonAccordingToInstalledPkgs(_configJson);

            bool rc = false;

            if (null != _impl)
            {
                rc = _impl.Setup(_configJson, language);
                _nativePsdkStarted = true;
                _silent            = false;
                PsdkEventSystem.RegisterNativeCallbacksAfterPsdkInitialization();
            }

            if (rc)
            {
                AppLifeCycleResumeState or = _appLifeCycleMgrService.OnResume();
                Debug.Log("PSDKMgr::Start resume state: " + or.ToString());
                foreach (IPsdkService ps in _registeredServices)
                {
                    try {
                        ps.psdkStartedEvent();
                    }
                    catch (System.Exception e) {
                        Debug.LogException(e);
                    }
                }
                if (or != AppLifeCycleResumeState.ALCRS_NONE)
                {
                    PsdkEventSystem.Instance.SendMessage("OnResumeEvent", or);
                }
            }

            return(rc);
        }