Skip to content

Commit ff8d082

Browse files
committed
Updated AndroidManifest for targeting API version 31 and higher, updated example app
1 parent 7481abf commit ff8d082

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
android:name="io.flutter.embedding.android.FlutterActivity"
1414
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1515
android:hardwareAccelerated="true"
16+
android:exported="true"
1617
android:launchMode="singleTop"
1718
android:theme="@style/LaunchTheme"
1819
android:windowSoftInputMode="adjustResize">

example/lib/main.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class _MyAppState extends State<MyApp> {
2222
String _errorString = "unknown";
2323
bool _isUserResolvable = false;
2424
bool _errorNotificationShown = false;
25+
bool _errorDialogFragmentShown = false;
2526

2627
// Platform messages are asynchronous, so we initialize in an async method.
2728
Future<void> checkPlayServices([bool showDialog = false]) async {
@@ -121,6 +122,25 @@ class _MyAppState extends State<MyApp> {
121122
});
122123
}
123124

125+
Future<void> showErrorDialogFragment() async {
126+
bool errorDialogFragmentShown;
127+
128+
try {
129+
errorDialogFragmentShown =
130+
await GoogleApiAvailability.instance.showErrorDialogFragment();
131+
} on PlatformException {
132+
errorDialogFragmentShown = false;
133+
}
134+
135+
if (!mounted) {
136+
return;
137+
}
138+
139+
setState(() {
140+
_errorDialogFragmentShown = errorDialogFragmentShown;
141+
});
142+
}
143+
124144
@override
125145
Widget build(BuildContext context) {
126146
return MaterialApp(
@@ -182,10 +202,7 @@ class _MyAppState extends State<MyApp> {
182202
child: const Text('Show error dialog fragment'),
183203
color: Colors.red,
184204
),
185-
Center(
186-
child: Text(
187-
'Error dialog shown: $_errorDialogShown\n')),
188-
205+
Center(child: Text('Error dialog shown: $_errorDialogFragmentShown\n')),
189206
],
190207
)),
191208
);

lib/src/google_api_availability.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,12 @@ class GoogleApiAvailability {
132132
}
133133

134134
final showErrorDialogFragment =
135-
await _methodChannel.invokeMethod('showErrorDialogFragment');
135+
await _methodChannel.invokeMethod('showErrorDialogFragment');
136136

137137
if (showErrorDialogFragment == null) {
138138
return false;
139139
}
140140

141141
return showErrorDialogFragment;
142142
}
143-
144143
}

0 commit comments

Comments
 (0)