Skip to content

Commit 49e4815

Browse files
authored
fix(android): parse android specific options correctly (#187)
1 parent 2cc2502 commit 49e4815

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/core/android/src/main/java/com/segment/analytics/reactnative/core/RNAnalyticsModule.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,17 @@ class RNAnalyticsModule(context: ReactApplicationContext): ReactContextBaseJavaM
134134
builder.trackAttributionInformation()
135135
}
136136

137-
if(options.hasKey("flushInterval")) {
138-
builder.flushInterval(
139-
options.getInt("flushInterval").toLong(),
140-
TimeUnit.MILLISECONDS
141-
)
137+
if(options.hasKey("android") && options.getType("android") == ReadableType.Map) {
138+
val androidOptions = options.getMap("android")!!
139+
if(androidOptions.hasKey("flushInterval")) {
140+
builder.flushInterval(
141+
androidOptions.getInt("flushInterval").toLong(),
142+
TimeUnit.MILLISECONDS
143+
)
144+
}
145+
if(androidOptions.hasKey("collectDeviceId")) {
146+
builder.collectDeviceId(androidOptions.getBoolean("collectDeviceId"))
147+
}
142148
}
143149

144150
if(options.getBoolean("debug")) {

0 commit comments

Comments
 (0)