From 1ed11546b6204c0dac20028129e0639135d66ab3 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Thu, 1 Feb 2024 15:11:58 +0300 Subject: [PATCH] refactor: update deprecated calls --- .../src/main/java/ly/count/java/demo/Example.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app-java/src/main/java/ly/count/java/demo/Example.java b/app-java/src/main/java/ly/count/java/demo/Example.java index ec96a831..831b8787 100755 --- a/app-java/src/main/java/ly/count/java/demo/Example.java +++ b/app-java/src/main/java/ly/count/java/demo/Example.java @@ -48,7 +48,7 @@ static void timedEventWithSumCountSegmentationAndDuration() { } static void setLocation() { - Countly.api().addLocation(31.5204, 74.3587); + Countly.instance().location().setLocation("UK", "London", "31.5204, 74.3587", null); } static void setUserProfile() { @@ -58,7 +58,7 @@ static void setUserProfile() { Countly.instance().userProfile().setProperty(PredefinedUserPropertyKeys.ORGANIZATION, "Tester"); Countly.instance().userProfile().setProperty(PredefinedUserPropertyKeys.PHONE, "+123456789"); Countly.instance().userProfile().setProperty(PredefinedUserPropertyKeys.PICTURE, new byte[] { 1, 2, 3, 4, 5 }); - //Countly.instance().userProfile().setProperty(UserPropertyKeys.PICTURE_PATH, "test.png"); to provide local path + //Countly.instance().userProfile().setProperty(PredefinedUserPropertyKeys.PICTURE_PATH, "test.png"); //to provide local path Countly.instance().userProfile().setProperty(PredefinedUserPropertyKeys.PICTURE_PATH, "https://someurl.com/test.png"); Countly.instance().userProfile().save(); } @@ -116,19 +116,18 @@ static void reportFeedbackWidgetManually(CountlyFeedbackWidget widget) { } static void recordStartView() { - Countly.api().view("Start view"); + Countly.instance().views().startView("Start view"); } static void recordAnotherView() { - Countly.api().view("Another view"); + Countly.instance().views().startView("Another view"); } static void recordCrash() { try { throw new ArithmeticException("/ by zero"); } catch (Exception e) { - e.printStackTrace(); - Countly.api().addCrashReport(e, false, "Divided by zero", null, "sample app"); + Countly.instance().crashes().recordHandledException(e); } } @@ -301,10 +300,10 @@ public void LogHappened(String logMessage, Config.LoggingLevel logLevel) { recordCrash(); break; case 12: - Countly.session().view("example_view").start(true); + Countly.instance().views().startView("example_view"); break; case 13: - Countly.session().view("example_view").stop(false); + Countly.instance().views().stopViewWithName("example_view"); break; case 14: changeDeviceIdWithMerge();