Exemple #1
0
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);

        SocketUtilsFactory.Utils = new SocketUtils();

        if (!string.IsNullOrEmpty(AppVersion))
        {
            Leanplum.SetAppVersion(AppVersion);
        }
        if (string.IsNullOrEmpty(AppID) || string.IsNullOrEmpty(ProductionKey) || string.IsNullOrEmpty(DevelopmentKey))
        {
            Debug.LogError("Please make sure to enter your AppID, Production Key, and " +
                           "Development Key in the Leanplum GameObject inspector before starting.");
        }

        if (Debug.isDebugBuild)
        {
            Leanplum.SetAppIdForDevelopmentMode(AppID, DevelopmentKey);
        }
        else
        {
            Leanplum.SetAppIdForProductionMode(AppID, ProductionKey);
        }

        Leanplum.Start();
    }
        private void InitLeanplum()
        {
            Leanplum.SetApplicationContext(this);
            LeanplumActivityHelper.EnableLifecycleCallbacks(this);

            Parser.ParseVariables(this);
            Leanplum.EnableVerboseLoggingInDevelopmentMode();
            Leanplum.SetAppIdForDevelopmentMode(Constants.LEANPLUM_APP_ID, Constants.LEANPLUM_DEV_APP_KEY);

            //Enable this for Production
            //Leanplum.SetAppIdForProductionMode(Constants.LEANPLUM_APP_ID, Constants.LEANPLUM_PROD_APP_KEY);
        }
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);

        SocketUtilsFactory.Utils = new SocketUtils();

        if (!string.IsNullOrEmpty(AppVersion))
        {
            Leanplum.SetAppVersion(AppVersion);
        }
        if (string.IsNullOrEmpty(AppID) || string.IsNullOrEmpty(ProductionKey) || string.IsNullOrEmpty(DevelopmentKey))
        {
            Debug.LogError("Please make sure to enter your AppID, Production Key, and " +
                           "Development Key in the Leanplum GameObject inspector before starting.");
        }

        if (Debug.isDebugBuild)
        {
            Leanplum.SetAppIdForDevelopmentMode(AppID, DevelopmentKey);
        }
        else
        {
            Leanplum.SetAppIdForProductionMode(AppID, ProductionKey);
        }

                #if UNITY_IPHONE
        Leanplum.RegisterForIOSRemoteNotifications();
                #elif UNITY_ANDROID
        // Registering for Push in Android - using the Built-in Sender ID
        Leanplum.SetGcmSenderId(Leanplum.LeanplumGcmSenderId);

        // This would be used if using your own sender ID.
//		Leanplum.SetGcmSenderId("123456790abcdef");

        // In this case using both sender IDs, for ex. if you want Leanplum to send notifications through Leanplum's ID
        // and your own server to send notifications through your own ID.
//		Leanplum.SetGcmSenderIds("123456790abcdef", Leanplum.LeanplumGcmSenderId);
                #endif

        Leanplum.Started += delegate(bool success) {
            Debug.Log("### Leanplum started");
        };

        Leanplum.VariablesChanged += delegate {
            Debug.Log("### Variables callback ");
        };

        Leanplum.Start();
    }
    void Start()
    {
        welcomeMessage = Var <string> .Define("welcomeMessage", "Welcome to Leanplum!");

        Var <bool> testBoolVariable = Var <bool> .Define("testBoolVariable", true);

        DontDestroyOnLoad(this.gameObject);

        SocketUtilsFactory.Utils = new SocketUtils();

        if (!string.IsNullOrEmpty(AppVersion))
        {
            Leanplum.SetAppVersion(AppVersion);
        }
        if (string.IsNullOrEmpty(AppID) || string.IsNullOrEmpty(ProductionKey) || string.IsNullOrEmpty(DevelopmentKey))
        {
            Debug.LogError("Please make sure to enter your AppID, Production Key, and " +
                           "Development Key in the Leanplum GameObject inspector before starting.");
        }


        Leanplum.SetDeviceId("23-March-D001");
//        if (Debug.isDebugBuild)
//        {
        Leanplum.SetAppIdForDevelopmentMode(AppID, DevelopmentKey);
//        }
//        else
//        {
//            Leanplum.SetAppIdForProductionMode(AppID, ProductionKey);
//        }

                #if UNITY_IPHONE
        Leanplum.RegisterForIOSRemoteNotifications();
                #elif UNITY_ANDROID
        Leanplum.SetGcmSenderId(Leanplum.LeanplumGcmSenderId);
                #endif


        Leanplum.VariablesChanged += delegate {
            Debug.Log("Variables Changed");
            Debug.Log(welcomeMessage.Value);
            Debug.Log(testBoolVariable.Value);
        };

        Leanplum.Start();
    }
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);

        SocketUtilsFactory.Utils = new SocketUtils();

        if (!string.IsNullOrEmpty(AppVersion))
        {
            Leanplum.SetAppVersion(AppVersion);
        }
        if (string.IsNullOrEmpty(AppID) || string.IsNullOrEmpty(ProductionKey) || string.IsNullOrEmpty(DevelopmentKey))
        {
            Debug.LogError("Please make sure to enter your AppID, Production Key, and " +
                           "Development Key in the Leanplum GameObject inspector before starting.");
        }

        if (Debug.isDebugBuild)
        {
            Leanplum.SetAppIdForDevelopmentMode(AppID, DevelopmentKey);
        }
        else
        {
            Leanplum.SetAppIdForProductionMode(AppID, ProductionKey);
        }

        Leanplum.Inbox.InboxChanged       += inboxChanged;
        Leanplum.Inbox.ForceContentUpdate += forceContentUpdate;

#if UNITY_EDITOR
        EditorMessageTemplates.DefineConfirm();
        EditorMessageTemplates.DefineOpenURL();
        EditorMessageTemplates.DefineGenericDefinition();
        LeanplumNative.ShouldPerformActions(true);
#endif

        Leanplum.Start();
    }