Пример #1
0
    void Awake()
    {
#if (UNITY_IPHONE && !UNITY_EDITOR)
        DontDestroyOnLoad(gameObject);
        CleverTapBinding.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);
        CleverTapBinding.LaunchWithCredentials(CLEVERTAP_ACCOUNT_ID, CLEVERTAP_ACCOUNT_TOKEN);
        // set to true to stop sending events to CleverTap
        CleverTapBinding.SetOptOut(true);
        // set to true to enable Device Network information to be sent to CleverTap
        CleverTapBinding.EnableDeviceNetworkInfoReporting(true);
        if (CLEVERTAP_ENABLE_PERSONALIZATION)
        {
            CleverTapBinding.EnablePersonalization();
        }
#endif

#if (UNITY_ANDROID && !UNITY_EDITOR)
        DontDestroyOnLoad(gameObject);
        //set the UI editor flag before getting the Clevertap instance, defaults to false.
        CleverTapBinding.SetUIEditorConnectionEnabled(true);
        CleverTapBinding.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);
        CleverTapBinding.Initialize(CLEVERTAP_ACCOUNT_ID, CLEVERTAP_ACCOUNT_TOKEN);
        if (CLEVERTAP_ENABLE_PERSONALIZATION)
        {
            CleverTapBinding.EnablePersonalization();
        }
        CleverTapBinding.CreateNotificationChannel("YourChannelId", "Your Channel Name", "Your Channel Description", 5, true);

        //CleverTapBinding.CreateNotificationChannelWithSound("YourChannelId","Your Channel Name", "Your Channel Description", 5, true, "Your raw sound file");
        //CleverTapBinding.CreateNotificationChannelGroup("YourGroupId", "Your Group Name");
        //CleverTapBinding.CreateNotificationChannelWithGroup("YourChannelId","Your Channel Name", "Your Channel Description", 5,"YourGroupId", true);
        //CleverTapBinding.CreateNotificationChannelWithGroupAndSound("YourChannelId","Your Channel Name", "Your Channel Description", 5,"YourGroupId", true,"Your raw sound file");
        //CleverTapBinding.DeleteNotificationChannel("YourChannelId");
        //CleverTapBinding.DeleteNotificationChannelGroup("YourGroupId");


        //app inbox
        CleverTapBinding.InitializeInbox();
        Debug.Log("InboxInit started");
        //registering Dynamic Variables
        CleverTapBinding.RegisterBooleanVariable("booleanVar");
        CleverTapBinding.RegisterDoubleVariable("doubleVar");
        CleverTapBinding.RegisterListOfDoubleVariable("listdouble");
        CleverTapBinding.RegisterMapOfDoubleVariable("mapDouble");
        CleverTapBinding.RecordEvent("Test Unity Event");
        //Invoke("LaunchInbox",30.0f);
#endif
    }
    /* --------------------------------------------------------------------------------
     *                          INITIALISATION
     * -------------------------------------------------------------------------------- */
    // Put all initialization, registeration code here
    void OnInit()
    {
        DontDestroyOnLoad(gameObject);

        //set the UI editor flag before getting the Clevertap instance, defaults to false.
        CleverTapBinding.SetUIEditorConnectionEnabled(true);
        CleverTapBinding.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);

        //Add Platform Specific Init Code here
#if (UNITY_IPHONE && !UNITY_EDITOR)
        OniOSInit();
#endif

#if (UNITY_ANDROID && !UNITY_EDITOR)
        OnAndroidInit();
#endif

        // set to true to stop sending events to CleverTap
        CleverTapBinding.SetOptOut(true);
        // set to true to enable Device Network information to be sent to CleverTap
        CleverTapBinding.EnableDeviceNetworkInfoReporting(true);
        if (CLEVERTAP_ENABLE_PERSONALIZATION)
        {
            CleverTapBinding.EnablePersonalization();
        }

        //app inbox
        CleverTapBinding.InitializeInbox();
        Debug.Log("InboxInit started");
        //registering Dynamic Variables
        CleverTapBinding.RegisterBooleanVariable("booleanVar");
        CleverTapBinding.RegisterDoubleVariable("doubleVar");
        CleverTapBinding.RegisterListOfDoubleVariable("listdouble");
        CleverTapBinding.RegisterMapOfDoubleVariable("mapDouble");
        CleverTapBinding.RecordEvent("Test Unity Event");
        //Invoke("LaunchInbox",30.0f);
    }