Skip to content

Commit d1a83c8

Browse files
authoredFeb 19, 2025··
Android version 1.1.0 Flutter 3.29.0 update, added example project (#58)
* Android version 1.0.2 update * updated changelog * Added an example project within the Android package to eliminate the need for an external dependency * updated build file

30 files changed

+582
-55
lines changed
 

‎.github/workflows/google_api_availability_android.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
env:
2525
source-directory: ./google_api_availability_android
26-
example-directory: ./google_api_availability/example
26+
example-directory: ./google_api_availability_android/example
2727

2828
# Steps represent a sequence of tasks that will be executed as part of the job
2929
steps:

‎google_api_availability_android/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.1.0
2+
3+
* Fixes compile errors for Flutter 3.29.0 (and above)
4+
* Updates compileSDKversion to 35
5+
16
## 1.0.1
27

38
* Adds support for the namespace property to support Android Gradle Plugin (AGP) 8.

‎google_api_availability_android/android/build.gradle

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
group 'com.baseflow.googleapiavailability'
22
version '1.0-SNAPSHOT'
33

4-
buildscript {
5-
repositories {
6-
google()
7-
mavenCentral()
8-
}
9-
10-
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.0'
12-
}
13-
}
14-
154
rootProject.allprojects {
165
repositories {
176
google()
@@ -27,7 +16,7 @@ android {
2716
namespace 'com.baseflow.googleapiavailability'
2817
}
2918

30-
compileSdkVersion 31
19+
compileSdkVersion 35
3120

3221
compileOptions {
3322
sourceCompatibility JavaVersion.VERSION_1_8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
rootProject.name = 'google_api_availability'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
9+
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11+
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
18+
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.1.0" apply false
22+
}
23+
24+
include ":app"

‎google_api_availability_android/android/src/main/java/com/baseflow/googleapiavailability/GoogleApiAvailabilityPlugin.java

+31-38
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
99
import io.flutter.plugin.common.BinaryMessenger;
1010
import io.flutter.plugin.common.MethodChannel;
11-
import io.flutter.plugin.common.PluginRegistry.Registrar;
12-
import io.flutter.plugin.common.PluginRegistry.ViewDestroyListener;
13-
import io.flutter.view.FlutterNativeView;
1411

1512
/**
1613
* GoogleApiAvailabilityPlugin
@@ -26,57 +23,53 @@ public GoogleApiAvailabilityPlugin() {
2623
}
2724

2825
@Override
29-
public void onAttachedToActivity(ActivityPluginBinding binding) {
30-
methodCallHandler.setActivity(binding.getActivity());
31-
}
26+
public void onAttachedToActivity(ActivityPluginBinding binding) {
27+
if (methodCallHandler != null) {
28+
methodCallHandler.setActivity(binding.getActivity());
29+
}
30+
}
3231

33-
@Override
34-
public void onDetachedFromActivity() {
35-
methodCallHandler.setActivity(null);
36-
}
32+
@Override
33+
public void onDetachedFromActivity() {
34+
if (methodCallHandler != null) {
35+
methodCallHandler.setActivity(null);
36+
}
37+
}
3738

38-
@Override
39-
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
40-
methodCallHandler.setActivity(binding.getActivity());
41-
}
39+
@Override
40+
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
41+
if (methodCallHandler != null) {
42+
methodCallHandler.setActivity(binding.getActivity());
43+
}
44+
}
4245

43-
@Override
44-
public void onDetachedFromActivityForConfigChanges() {
45-
methodCallHandler.setActivity(null);
46-
}
46+
@Override
47+
public void onDetachedFromActivityForConfigChanges() {
48+
if (methodCallHandler != null) {
49+
methodCallHandler.setActivity(null);
50+
}
51+
}
4752

48-
@Override
49-
public void onAttachedToEngine(FlutterPluginBinding binding) {
50-
registerPlugin(binding.getApplicationContext(), binding.getBinaryMessenger());
51-
}
53+
@Override
54+
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
55+
registerPlugin(binding.getApplicationContext(), binding.getBinaryMessenger());
56+
}
5257

5358
@Override
5459
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
5560
unregisterPlugin();
5661
}
5762

58-
public static void registerWith(Registrar registrar) {
59-
final GoogleApiAvailabilityPlugin plugin = new GoogleApiAvailabilityPlugin();
60-
plugin.registerPlugin(registrar.context(), registrar.messenger());
61-
plugin.methodCallHandler.setActivity(registrar.activity());
62-
63-
registrar.addViewDestroyListener(new ViewDestroyListener() {
64-
@Override
65-
public boolean onViewDestroy(FlutterNativeView view) {
66-
plugin.unregisterPlugin();
67-
return false;
68-
}
69-
});
70-
}
71-
7263
private void registerPlugin(Context context, BinaryMessenger messenger) {
7364
methodCallHandler = new MethodCallHandlerImpl(context, googleApiAvailabilityManager);
7465
channel = new MethodChannel(messenger, "flutter.baseflow.com/google_api_availability_android/methods");
7566
channel.setMethodCallHandler(methodCallHandler);
7667
}
7768

7869
private void unregisterPlugin() {
79-
channel.setMethodCallHandler(null);
80-
channel = null;
70+
if (channel != null) {
71+
channel.setMethodCallHandler(null);
72+
channel = null;
73+
}
8174
}
8275
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# Visual Studio Code related
19+
.vscode/
20+
21+
# Flutter/Dart/Pub related
22+
**/doc/api/
23+
.dart_tool/
24+
.flutter-plugins
25+
.packages
26+
.pub-cache/
27+
.pub/
28+
/build/
29+
30+
# Android related
31+
**/android/**/gradle-wrapper.jar
32+
**/android/.gradle
33+
**/android/captures/
34+
**/android/gradlew
35+
**/android/gradlew.bat
36+
**/android/local.properties
37+
**/android/**/GeneratedPluginRegistrant.java
38+
39+
# iOS/XCode related
40+
**/ios/**/*.mode1v3
41+
**/ios/**/*.mode2v3
42+
**/ios/**/*.moved-aside
43+
**/ios/**/*.pbxuser
44+
**/ios/**/*.perspectivev3
45+
**/ios/**/*sync/
46+
**/ios/**/.sconsign.dblite
47+
**/ios/**/.tags*
48+
**/ios/**/.vagrant/
49+
**/ios/**/DerivedData/
50+
**/ios/**/Icon?
51+
**/ios/**/Pods/
52+
**/ios/**/.symlinks/
53+
**/ios/**/profile
54+
**/ios/**/xcuserdata
55+
**/ios/.generated/
56+
**/ios/Flutter/App.framework
57+
**/ios/Flutter/Flutter.framework
58+
**/ios/Flutter/Generated.xcconfig
59+
**/ios/Flutter/app.flx
60+
**/ios/Flutter/app.zip
61+
**/ios/Flutter/flutter_assets/
62+
**/ios/ServiceDefinitions.json
63+
**/ios/Runner/GeneratedPluginRegistrant.*
64+
65+
# Exceptions to above rules.
66+
!**/ios/**/default.mode1v3
67+
!**/ios/**/default.mode2v3
68+
!**/ios/**/default.pbxuser
69+
!**/ios/**/default.perspectivev3
70+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 035e0765cc575c3b455689c2402cce073d564fce
8+
channel: master
9+
10+
project_type: app
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# google_api_availability_example
2+
3+
Demonstrates how to use the google_api_availability plugin.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
13+
14+
For help getting started with Flutter, view our
15+
[online documentation](https://flutter.io/docs), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
*.class
3+
.gradle
4+
/local.properties
5+
/.idea/workspace.xml
6+
/.idea/libraries
7+
.DS_Store
8+
/build
9+
/captures
10+
GeneratedPluginRegistrant.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
arguments=
2+
auto.sync=false
3+
build.scans.enabled=false
4+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5+
connection.project.dir=
6+
eclipse.preferences.version=1
7+
gradle.user.home=
8+
java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
9+
jvm.arguments=
10+
offline.mode=false
11+
override.workspace.settings=true
12+
show.console.view=true
13+
show.executions.view=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
4+
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5+
<classpathentry kind="output" path="bin/default"/>
6+
</classpath>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
connection.project.dir=..
2+
eclipse.preferences.version=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
plugins {
2+
id "com.android.application"
3+
id "dev.flutter.flutter-gradle-plugin"
4+
}
5+
6+
def localProperties = new Properties()
7+
def localPropertiesFile = rootProject.file('local.properties')
8+
if (localPropertiesFile.exists()) {
9+
localPropertiesFile.withReader('UTF-8') { reader ->
10+
localProperties.load(reader)
11+
}
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
android {
25+
namespace 'com.baseflow.googleapiavailabilityexample'
26+
compileSdkVersion flutter.compileSdkVersion
27+
28+
compileOptions {
29+
sourceCompatibility JavaVersion.VERSION_1_8
30+
targetCompatibility JavaVersion.VERSION_1_8
31+
}
32+
33+
lintOptions {
34+
disable 'InvalidPackage'
35+
}
36+
37+
defaultConfig {
38+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
39+
applicationId "com.baseflow.googleapiavailabilityexample"
40+
minSdkVersion flutter.minSdkVersion
41+
targetSdkVersion flutter.targetSdkVersion
42+
versionCode flutterVersionCode.toInteger()
43+
versionName flutterVersionName
44+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
45+
}
46+
47+
buildTypes {
48+
release {
49+
// TODO: Add your own signing config for the release build.
50+
// Signing with the debug keys for now, so `flutter run --release` works.
51+
signingConfig signingConfigs.debug
52+
}
53+
}
54+
}
55+
56+
flutter {
57+
source '../..'
58+
}
59+
60+
dependencies {
61+
androidTestImplementation 'androidx.test:runner:1.2.0'
62+
androidTestImplementation 'androidx.test:rules:1.2.0'
63+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools">
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
5+
<application
6+
android:name="${applicationName}"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="google_api_availability_example"
9+
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
10+
<activity
11+
android:name="io.flutter.embedding.android.FlutterActivity"
12+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
13+
android:hardwareAccelerated="true"
14+
android:exported="true"
15+
android:launchMode="singleTop"
16+
android:theme="@style/LaunchTheme"
17+
android:windowSoftInputMode="adjustResize">
18+
<meta-data android:name="flutterEmbedding" android:value="2"/>
19+
<!-- This keeps the window background of the activity showing
20+
until Flutter renders its first frame. It can be removed if
21+
there is no splash screen (such as the default splash screen
22+
defined in @style/LaunchTheme). -->
23+
<meta-data
24+
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
25+
android:value="true" />
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
<category android:name="android.intent.category.LAUNCHER" />
29+
</intent-filter>
30+
</activity>
31+
32+
<activity
33+
android:name=".EmbeddingV1Activity"
34+
android:theme="@style/LaunchTheme"
35+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
36+
android:hardwareAccelerated="true"
37+
android:windowSoftInputMode="adjustResize" />
38+
<meta-data android:name="flutterEmbedding" android:value="2"/>
39+
</application>
40+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="@android:color/white" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
4+
<!-- Show a splash screen on the activity. Automatically removed when
5+
Flutter draws its first frame -->
6+
<item name="android:windowBackground">@drawable/launch_background</item>
7+
</style>
8+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
allprojects {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
}
7+
8+
rootProject.buildDir = '../build'
9+
subprojects {
10+
project.buildDir = "${rootProject.buildDir}/${project.name}"
11+
}
12+
subprojects {
13+
project.evaluationDependsOn(':app')
14+
}
15+
16+
tasks.register("clean", Delete) {
17+
delete rootProject.buildDir
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
android.enableJetifier=true
2+
android.useAndroidX=true
3+
android.enableR8=true
4+
org.gradle.jvmargs=-Xmx1536M
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Apr 01 07:57:11 BST 2020
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
9+
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11+
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
18+
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.1.0" apply false
22+
}
23+
24+
include ":app"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
import 'dart:async';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter/services.dart';
5+
import 'package:google_api_availability_android/google_api_availability_android.dart';
6+
import 'package:google_api_availability_platform_interface/google_api_availability_platform_interface.dart';
7+
8+
void main() => runApp(const MyApp());
9+
10+
///Creates the mutable state for this widget.
11+
class MyApp extends StatefulWidget {
12+
/// Named [key] parameter to identify a widget.
13+
const MyApp({Key? key}) : super(key: key);
14+
15+
@override
16+
// ignore: library_private_types_in_public_api
17+
_MyAppState createState() => _MyAppState();
18+
}
19+
20+
class _MyAppState extends State<MyApp> {
21+
GooglePlayServicesAvailability _playStoreAvailability =
22+
GooglePlayServicesAvailability.unknown;
23+
String _errorString = 'unknown';
24+
bool _isUserResolvable = false;
25+
bool _errorDialogFragmentShown = false;
26+
27+
// Platform messages are asynchronous, so we initialize in an async method.
28+
Future<void> checkPlayServices([bool showDialog = false]) async {
29+
GooglePlayServicesAvailability playStoreAvailability;
30+
// Platform messages may fail, so we use a try/catch PlatformException.
31+
try {
32+
playStoreAvailability = await GoogleApiAvailabilityAndroid()
33+
.checkGooglePlayServicesAvailability(showDialog);
34+
} on PlatformException {
35+
playStoreAvailability = GooglePlayServicesAvailability.unknown;
36+
}
37+
38+
// If the widget was removed from the tree while the asynchronous platform
39+
// message was in flight, we want to discard the reply rather than calling
40+
// setState to update our non-existent appearance.
41+
if (!mounted) {
42+
return;
43+
}
44+
45+
setState(() {
46+
_playStoreAvailability = playStoreAvailability;
47+
});
48+
}
49+
50+
Future<void> makeGooglePlayServicesAvailable() async {
51+
try {
52+
await GoogleApiAvailabilityAndroid().makeGooglePlayServicesAvailable();
53+
} on PlatformException {
54+
return;
55+
}
56+
57+
if (!mounted) {
58+
return;
59+
}
60+
}
61+
62+
Future<void> getErrorString() async {
63+
String errorString;
64+
65+
try {
66+
errorString = await GoogleApiAvailabilityAndroid().getErrorString();
67+
} on PlatformException {
68+
errorString = 'Not available on non Android devices';
69+
}
70+
71+
if (!mounted) {
72+
return;
73+
}
74+
75+
setState(() {
76+
_errorString = errorString;
77+
});
78+
}
79+
80+
Future<void> isUserResolvable() async {
81+
bool isUserResolvable;
82+
83+
try {
84+
isUserResolvable =
85+
await GoogleApiAvailabilityAndroid().isUserResolvable();
86+
} on PlatformException {
87+
isUserResolvable = false;
88+
}
89+
90+
if (!mounted) {
91+
return;
92+
}
93+
94+
setState(() {
95+
_isUserResolvable = isUserResolvable;
96+
});
97+
}
98+
99+
Future<void> showErrorNotification() async {
100+
try {
101+
await GoogleApiAvailabilityAndroid().showErrorNotification();
102+
} on PlatformException {
103+
return;
104+
}
105+
106+
if (!mounted) {
107+
return;
108+
}
109+
}
110+
111+
Future<void> showErrorDialogFragment() async {
112+
bool errorDialogFragmentShown;
113+
114+
try {
115+
errorDialogFragmentShown =
116+
await GoogleApiAvailabilityAndroid().showErrorDialogFragment();
117+
} on PlatformException {
118+
errorDialogFragmentShown = false;
119+
}
120+
121+
if (!mounted) {
122+
return;
123+
}
124+
125+
setState(() {
126+
_errorDialogFragmentShown = errorDialogFragmentShown;
127+
});
128+
}
129+
130+
@override
131+
Widget build(BuildContext context) {
132+
return MaterialApp(
133+
home: Scaffold(
134+
appBar: AppBar(
135+
title: const Text('Plugin example app'),
136+
),
137+
body: ListView(
138+
children: <Widget>[
139+
MaterialButton(
140+
onPressed: () => checkPlayServices(),
141+
color: Colors.red,
142+
child: const Text('Get PlayServices availability'),
143+
),
144+
Center(
145+
child: Text(
146+
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n')),
147+
MaterialButton(
148+
onPressed: () => checkPlayServices(true),
149+
color: Colors.redAccent,
150+
child:
151+
const Text('Get PlayServices availability with fix dialog'),
152+
),
153+
Center(
154+
child: Text(
155+
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n')),
156+
MaterialButton(
157+
onPressed: () => makeGooglePlayServicesAvailable(),
158+
color: Colors.red,
159+
child: const Text('Make Google Play Service available'),
160+
),
161+
const SizedBox(height: 30),
162+
MaterialButton(
163+
onPressed: () => getErrorString(),
164+
color: Colors.red,
165+
child: const Text('Get string of the error code'),
166+
),
167+
Center(child: Text('Error string: $_errorString\n')),
168+
MaterialButton(
169+
onPressed: () => isUserResolvable(),
170+
color: Colors.red,
171+
child: const Text('Error resolvable by user'),
172+
),
173+
Center(
174+
child:
175+
Text('Error resolvable by user: $_isUserResolvable\n')),
176+
MaterialButton(
177+
onPressed: () => showErrorNotification(),
178+
color: Colors.red,
179+
child: const Text('Show error notification'),
180+
),
181+
const SizedBox(height: 30),
182+
MaterialButton(
183+
onPressed: () => showErrorDialogFragment(),
184+
color: Colors.red,
185+
child: const Text('Show error dialog fragment'),
186+
),
187+
Center(
188+
child:
189+
Text('Error dialog shown: $_errorDialogFragmentShown\n')),
190+
],
191+
)),
192+
);
193+
}
194+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: google_api_availability_example
2+
description: Demonstrates how to use the google_api_availability plugin.
3+
version: 1.0.0+1
4+
publish_to: none
5+
6+
environment:
7+
sdk: ">=2.15.0 <3.0.0"
8+
9+
dependencies:
10+
flutter:
11+
sdk: flutter
12+
google_api_availability_android:
13+
path: ../
14+
google_api_availability_platform_interface: ^1.0.1
15+
16+
dev_dependencies:
17+
flutter_lints: 1.0.4
18+
19+
flutter:
20+
uses-material-design: true

‎google_api_availability_android/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: An Android implementation for the google_api_availability plugin.
33
repository: https://github.com/baseflow/flutter-google-api-availability/tree/main/google_api_availability_android
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 1.0.1
6+
version: 1.1.0
77

88
flutter:
99
plugin:

‎google_api_availability_android/test/method_channel_mock.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MethodChannelMock {
1313
this.result,
1414
this.delay = Duration.zero,
1515
}) : methodChannel = MethodChannel(channelName) {
16-
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
16+
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
1717
.setMockMethodCallHandler(methodChannel, _handler);
1818
}
1919

0 commit comments

Comments
 (0)
Please sign in to comment.