Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 19ebcee

Browse files
author
Langston Smith
authored
Added try/catch for getting getISO3Country for analytics (#1182)
1 parent 259d561 commit 19ebcee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SharedCode/src/main/java/com/mapbox/mapboxandroiddemo/commons/AnalyticsTracker.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.HashMap;
1515
import java.util.Locale;
1616
import java.util.Map;
17+
import java.util.MissingResourceException;
1718

1819
/**
1920
* This class abstracts various analytics calls to Segment analytics' Java library.
@@ -94,7 +95,11 @@ public void openedAppForFirstTime(boolean isTablet, boolean loggedIn) {
9495
properties.put("tags", Build.TAGS);
9596
properties.put("iso3 language", Locale.getDefault().getISO3Language());
9697
properties.put("language", Locale.getDefault().getLanguage());
97-
properties.put("iso3 country", Locale.getDefault().getISO3Country());
98+
try {
99+
properties.put("iso3 country", Locale.getDefault().getISO3Country());
100+
} catch (MissingResourceException exception) {
101+
// Empty on purpose. No need to do anything.
102+
}
98103
properties.put("country", Locale.getDefault().getCountry());
99104
properties.put("display country", Locale.getDefault().getDisplayCountry());
100105
properties.put("display name", Locale.getDefault().getDisplayName());

0 commit comments

Comments
 (0)