Skip to content

Commit 4434a39

Browse files
authored
Add api 21 check to LocalizationChannel.java (flutter#7967)
1 parent 113b91f commit 4434a39

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package io.flutter.embedding.engine.systemchannels;
66

7+
import android.os.Build;
78
import android.support.annotation.NonNull;
89

910
import java.util.ArrayList;
@@ -35,7 +36,8 @@ public void sendLocales(List<Locale> locales) {
3536
for (Locale locale : locales) {
3637
data.add(locale.getLanguage());
3738
data.add(locale.getCountry());
38-
data.add(locale.getScript());
39+
// locale.getScript() was added in API 21.
40+
data.add(Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "");
3941
data.add(locale.getVariant());
4042
}
4143
channel.invokeMethod("setLocale", data);

0 commit comments

Comments
 (0)