Skip to content

Commit

Permalink
fix: fix other location info not auto populate (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhao900914 authored Sep 29, 2022
1 parent 59a1b07 commit 5810c9d
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ class AndroidContextPlugin : Plugin {
if (trackingOptions.shouldTrackCarrier()) {
event.carrier = contextProvider.carrier
}
if (trackingOptions.shouldTrackCountry()) {
if (trackingOptions.shouldTrackIpAddress()) {
event.ip ?: let {
// get the ip in server side if there is no event level ip
event.ip = "\$remote"
}
}
if (trackingOptions.shouldTrackCountry() && event.ip !== "\$remote") {
event.country = contextProvider.country
}
if (trackingOptions.shouldTrackLanguage()) {
Expand Down Expand Up @@ -145,10 +151,6 @@ class AndroidContextPlugin : Plugin {
event.partnerId = it
}
}
event.ip ?: let {
// get the ip in server side if there is no event level ip
event.ip = "\$remote"
}
event.plan ?: let {
amplitude.configuration.plan ?. let {
event.plan = it.clone()
Expand Down

0 comments on commit 5810c9d

Please sign in to comment.