public void Init(ADJPConfig config) { // Get environment variable. AndroidJavaObject ajoEnvironment = config.environment == ADJPEnvironment.Sandbox ? new AndroidJavaClass("com.adjust.sdk.purchase.ADJPConstants").GetStatic <AndroidJavaObject>("ENVIRONMENT_SANDBOX") : new AndroidJavaClass("com.adjust.sdk.purchase.ADJPConstants").GetStatic <AndroidJavaObject>("ENVIRONMENT_PRODUCTION"); // Create adjust config object. AndroidJavaObject ajoConfig = new AndroidJavaObject("com.adjust.sdk.purchase.ADJPConfig", config.appToken, ajoEnvironment); // Check log level. if (config.logLevel.HasValue) { AndroidJavaObject ajoLogLevel = new AndroidJavaClass("com.adjust.sdk.purchase.ADJPLogLevel").GetStatic <AndroidJavaObject>(config.logLevel.Value.UppercaseToString()); if (ajoLogLevel != null) { ajoConfig.Call("setLogLevel", ajoLogLevel); } } // Set unity SDK prefix. ajoConfig.Call("setSdkPrefix", sdkPrefix); // Initialise and start the SDK. ajcAdjustPurchase.CallStatic("init", ajoConfig); }
public static void Init(ADJPConfig config) { if (AdjustPurchase.instance != null) { Debug.Log("adjust purchase: Error, purchase SDK already started."); return; } if (config == null) { Debug.Log("adjust purchase: Missing config to start."); return; } #if UNITY_EDITOR AdjustPurchase.instance = null; #elif UNITY_IOS AdjustPurchase.instance = new AdjustPurchaseiOS(); #elif UNITY_ANDROID AdjustPurchase.instance = new AdjustPurchaseAndroid(); #else AdjustPurchase.instance = null; #endif if (AdjustPurchase.instance == null) { Debug.Log("adjust purchase: Purchase SDK can only be used in Android and iOS apps."); return; } AdjustPurchase.instance.Init(config); }
public void Init(ADJPConfig config) { string appToken = config.appToken; string environment = config.environment.LowercaseToString(); int logLevel = ADJPUtils.ConvertLogLevel(config.logLevel); _AdjustPurchaseInit(appToken, environment, sdkPrefix, logLevel); }
void Awake() { if (AdjustPurchase.instance != null) { return; } DontDestroyOnLoad(transform.gameObject); if (!this.startManually) { ADJPConfig config = new ADJPConfig(this.appToken, this.environment); config.SetLogLevel(this.logLevel); AdjustPurchase.Init(config); } }