Skip to content

Commit

Permalink
refactor: update deprecated calls (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray authored Feb 2, 2024
1 parent 88fe67d commit c908a57
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app-java/src/main/java/ly/count/java/demo/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c908a57

Please sign in to comment.