Skip to content

Commit 223806b

Browse files
committed
made minor code changes
1 parent 63b94dc commit 223806b

File tree

1 file changed

+8
-19
lines changed
  • src/connections/sources/catalog/libraries/mobile/android

1 file changed

+8
-19
lines changed

src/connections/sources/catalog/libraries/mobile/android/index.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ analyticsContext.putValue(...).putReferrer(...).putCampaign(...);
535535

536536
{% codeexampletab Kotlin %}
537537
```kotlin
538-
val analyticsContext = Analytics.with(context).getAnalyticsContext()
538+
val analyticsContext = Analytics.with(context).analyticsContext()
539539
analyticsContext.putValue(...).putReferrer(...).putCampaign(...)
540540
```
541541
{% endcodeexampletab %}
@@ -555,7 +555,7 @@ analyticsContext.device().putValue("advertisingId", "1");
555555

556556
{% codeexampletab Kotlin %}
557557
```kotlin
558-
val analyticsContext = Analytics.with(context).getAnalyticsContext()
558+
val analyticsContext = Analytics.with(context).analyticsContext()
559559
analyticsContext.device().putValue("advertisingId", "1")
560560
```
561561
{% endcodeexampletab %}
@@ -567,15 +567,15 @@ To opt out of automatic data collection, clear the context after initializing th
567567
{% codeexampletab Java %}
568568
```java
569569
Analytics analytics = new Analytics.Builder(context, writeKey).defaultOptions(defaultOptions).build();
570-
AnalyticsContext context = analytics.getContext();
570+
AnalyticsContext context = getAnalyticsContext();
571571
context.clear();
572572
```
573573
{% endcodeexampletab %}
574574

575575
{% codeexampletab Kotlin %}
576576
```kotlin
577577
val analytics = Analytics.Builder(context, writeKey).defaultOptions(defaultOptions).build()
578-
val context = analytics.getContext()
578+
val context = analytics.analyticsContext()
579579
context.clear()
580580
```
581581
{% endcodeexampletab %}
@@ -731,7 +731,7 @@ Analytics.with(context).getAnalyticsContext().traits().anonymousId();
731731

732732
{% codeexampletab Kotlin %}
733733
```kotlin
734-
Analytics.with(context).getAnalyticsContext().traits().anonymousId()
734+
Analytics.with(context).analyticsContext().traits().anonymousId()
735735
```
736736
{% endcodeexampletab %}
737737
{% endcodeexample %}
@@ -776,7 +776,7 @@ log(snapshot.flushCount);
776776

777777
{% codeexampletab Kotlin %}
778778
```kotlin
779-
val snapshot = Analytics.with(context).getSnapshot()
779+
val snapshot = Analytics.with(context).snapshot()
780780
log(snapshot.integrationOperationAverageDuration)
781781
log(snapshot.flushCount)
782782
```
@@ -818,17 +818,13 @@ Depending on the audience for your app (for example, children) or the countries
818818
{% codeexample %}
819819
{% codeexampletab Java %}
820820
```java
821-
public void optOut(boolean optOut) {
822-
this.optOut.set(optOut);
823-
}
821+
Analytics.with(this).optOut(true);
824822
```
825823
{% endcodeexampletab %}
826824

827825
{% codeexampletab Kotlin %}
828826
```kotlin
829-
fun optOut(optOut: Boolean) {
830-
optOut to optOut
831-
}
827+
Analytics.with(this).optOut(true)
832828
```
833829
{% endcodeexampletab %}
834830
{% endcodeexample %}
@@ -882,13 +878,6 @@ import com.segment.analytics.Analytics
882878
import com.segment.analytics.Properties
883879
import com.segment.analytics.Properties.Product
884880

885-
// initialize product variables
886-
lateinit var id: String
887-
lateinit var orderId: String
888-
lateinit var sku: String
889-
var price = 0.0
890-
var revenue = 0.0
891-
892881
// initialize a new properties object
893882
val properties = Properties();
894883

0 commit comments

Comments
 (0)