Example #1
0
        public static void Init(Application app, String branchKey, IBranchSessionInterface callback)
        {
            if (instance != null)
            {
                return;
            }

            if (!branchKey.StartsWith("key_", StringComparison.Ordinal))
            {
                Console.WriteLine(branchKey + ":  Usage of App Key is deprecated, please move toward using a Branch key");
            }

            instance = new BranchAndroid();
            Branch.branchInstance = instance;
            instance.appContext   = app.ApplicationContext;
            instance.branchKey    = branchKey;


            if (Debug)
            {
                instance.SetDebug();
            }

            instance.lifeCycleHandler = new BranchAndroidLifeCycleHandler(callback);
            app.RegisterActivityLifecycleCallbacks(instance.lifeCycleHandler);

            // we call IniSession in BranchAndroidLifeCycleHandler.OnActivityStarted
            //getInstance().InitSession(callback);
        }
Example #2
0
        public static void Init(Application app, String branchKey, IBranchBUOSessionInterface callback)
        {
            if (instance != null)
            {
                instance.lifeCycleHandler.callbackBUO = callback;
                return;
            }

            if (!branchKey.StartsWith("key_"))
            {
                Console.WriteLine("Usage of App Key is deprecated, please move toward using a Branch key");
            }

            instance = new BranchAndroid();
            Branch.branchInstance = instance;
            instance.appContext   = app.ApplicationContext;
            instance.branchKey    = branchKey;

            if (Debug)
            {
                instance.SetDebug();
            }

            instance.lifeCycleHandler = new BranchAndroidLifeCycleHandler(callback);
            app.RegisterActivityLifecycleCallbacks(instance.lifeCycleHandler);
        }
        private void DecreaseActivityCounter(Activity activity)
        {
            if (activeCounter > 0)
            {
                activeCounter--;

                if (activeCounter == 0)
                {
                    BranchAndroid.getInstance().CloseSession();
                }
            }
        }
        private void IncreaseActivityCounter(Activity activity)
        {
            if (activeCounter == 0)
            {
                if (callback != null)
                {
                    BranchAndroid.getInstance().InitSession(callback);
                }
                else if (callbackBUO != null)
                {
                    BranchAndroid.getInstance().InitSession(callbackBUO);
                }
            }

            activeCounter++;
        }
 public void OnActivityStarted(Activity activity)
 {
     BranchAndroid.getInstance().CurrActivity = activity;
     IncreaseActivityCounter(activity);
 }