Code Monkey home page Code Monkey logo

flutter-google-api-availability's People

Contributors

deckerst avatar ened avatar jddv avatar jeroenweener avatar long1eu avatar martijn00 avatar mvanbeusekom avatar raphicci avatar wenxiangjiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-google-api-availability's Issues

Refactor to use Federated Plugin Architecture

๐Ÿ— Enhancement Proposal

The plugin architecture should be transitioned to a federated architecture to be in line with Google's stance on plugin architectures.

Pitch

Even though this plugin only considers Android, adhering to the newest standards will make the project more approachable for developers that have worked with Flutter Plugins before. Additionally, when running the plugin on a different platform, the Android code can be pruned.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Support null safety

๐Ÿš€ Feature Requests

This is a request to add support for null safety to package:google_api_availability.
We depend on your awesome package, so would be great to have null safety enabled.

Contextualize the feature

The Dart/Flutter team already encourages publishing the migrated packages: See this blog post.

Describe the feature

See the migration guide for details about enabling null safety.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Use the Federated Plugin Architecture

๐Ÿ— Enhancement Proposal

The plugin architecture should be transitioned to a federated architecture to be in line with Google's stance on plugin architectures.

Pitch

Even though this plugin only considers Android, adhering to the newest standards will make the project more approachable for developers that have worked with Flutter Plugins before. Additionally, when running the plugin on a different platform, the Android code can be pruned.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Resolve code deprecation warnings.

๐Ÿ— Enhancement Proposal

Resolve these code deprecation warnings:

\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:11: warning: [deprecation] Registrar in PluginRegistry has been deprecated
import io.flutter.plugin.common.PluginRegistry.Registrar;
^
\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:12: warning: [deprecation] ViewDestroyListener in PluginRegistry has been deprecated
import io.flutter.plugin.common.PluginRegistry.ViewDestroyListener;
^
\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:13: warning: [deprecation] FlutterNativeView in io.flutter.view has been deprecated
import io.flutter.view.FlutterNativeView;
^
\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:58: warning: [deprecation] Registrar in PluginRegistry has been deprecated
public static void registerWith(Registrar registrar) {
^
\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:63: warning: [deprecation] ViewDestroyListener in PluginRegistry has been deprecated
registrar.addViewDestroyListener(new ViewDestroyListener() {
^
\google_api_availability_android-1.0.0+1\android\src\main\java\com\baseflow\googleapiavailability\GoogleApiAvailabilityPlugin.java:65: warning: [deprecation] FlutterNativeView in io.flutter.view has been deprecated
public boolean onViewDestroy(FlutterNativeView view) {

                               ^

6 warnings

Pitch

It will prevent breaking aplications when updating other flutter and dart packages, even flutter or dart themselves.

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Update PR- and issue template

Check if issue template can dictate a status.
Simplify PR- and issue template using flutter templates as reference

Incorrect semver when updated to AndroidX

๐Ÿ› Bug Report

This library did not follow proper semver when it updated to AndroidX. Version 1.0.5 was updated to AndroidX and this is a breaking change yet the previous version was 1.0.4!

This could be an even bigger problem if this library is used as a transitive dependency from another library (as it was in my case) as it is not obvious that this library is the issue.

I was able to work around this issue by doing the following in my pubspec.yaml:

dependency_overrides:
  google_api_availability: 1.0.4

Expected behavior

I should be able to put google_api_availability: ^1.0.0 in my pubspec.yaml and rely on that any versions within 1.0.x will not break me. This is proper semver and Dart's versioning relies heavily on libraries following semver. The proper version update for the AndroidX compatible release should have been 1.1.0. This would have ensured that only people who manully updated to ^1.1.0 would get the breaking change. To see an example of how to do this, look at the cloud_firestore changelog.

Reproduction steps

Put google_api_availability: ^1.0.0 in a project that has not been updated to AndroidX. You will get errors when it tries to multidex. Something like:

Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

Configuration

A Flutter project that is not updated to AndroidX and uses multidex.

Version: 1.0.5

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Upgrade Kotlin version

๐Ÿ› Bug Report

I can't upgrade the latest Gradle plugin version to (>3.2.0) because of this plugin. Which in turn leaves me unable to use the new app format (Android App Bundle). This is because this plugin expects kotlin plugin to be at version 1.2.71. For the new Gradle plugin the kotlin version must be at least 1.3.0.

Expected behavior

the app should compile

Reproduction steps

add this plugin (or for instance geolocator, which has this as a dependency) and allow Android Studio to upgrade to the latest Gradle.

Configuration

Android studio version 3.3 on windows, flutter updated to latest version

Version: 1.0.4

Platform:

  • ๐Ÿ“ฑ iOS
  • [X ] ๐Ÿค– Android

Return Play Services version

๐Ÿš€ Feature Requests

Would it be possible for you to also return a version of Google Play Services running on the device? This info is needed in order to prompt the user to update it in case it does not support needed functionality.

Contextualize the feature

Describe the feature

Platforms affected (mark all that apply)

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

fatal error: 'google_api_availability/google_api_availability-Swift.h' file not found

๐Ÿ› Bug Report

I'm facing this error trying to build my Flutter project for iOS with "flutter build ios" command:

Building com.*******.mobile for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: *********
Running pod install... 2.0s
Starting Xcode build...
Xcode build done. 24.9s
Failed to build iOS app
Error output from Xcode build:
โ†ณ
** BUILD FAILED **

Xcode's output:
โ†ณ
/Users/dev/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/google_api_availability-1.0.2/ios/Classes/GoogleApiAvailabilityPlugin.m:2:9: fatal error: 'google_api_availability/google_api_availability-Swift.h' file not found
#import <google_api_availability/google_api_availability-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/dev/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-2.0.1/ios/Classes/GeolocatorPlugin.m:2:9: fatal error: 'geolocator/geolocator-Swift.h' file not found
#import <geolocator/geolocator-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Encountered error while building for device.

This is the output of flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[โœ“] Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.2 17C88, locale en-BG)
[โœ—] Android toolchain - develop for Android devices
โœ— Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[โœ“] iOS toolchain - develop for iOS devices (Xcode 9.2)
[โœ—] Android Studio (not installed)
[!] IntelliJ IDEA Ultimate Edition (version 2017.2.5)
โœ— Flutter plugin not installed; this adds Flutter specific functionality.
โœ— Dart plugin not installed; this adds Dart specific functionality.
[!] Connected devices
! No devices available

This is how my pubspec.yaml file looks like:

name: ****
description: ***

version: 1.0.0+1

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
intl: 0.15.7
cupertino_icons: ^0.1.2
http: 0.11.3+17
shared_preferences: 0.4.2
google_api_availability: ^1.0.2
geolocator: ^2.0.1

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true

The SWIFT_VERSION from Xcode is 4.0. Any help will be very much appreciated.

Version: 1.0.2

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

GoogleApiAvailability() doesn't have a default constructor

๐Ÿ› Bug Report

I copy-past this line of code from your package Readme page:

GooglePlayServicesAvailability availability = await GoogleApiAvailability().checkGooglePlayServicesAvailability();

But I immediately get the error:

The class 'GoogleApiAvailability' doesn't have a default constructor. Try using one of the named constructors defined in 'GoogleApiAvailability'.

Version: 2.0.4

Platform:

  • ๐Ÿค– Android

NPE when running in a background service

๐Ÿ”™ Regression

The plugin shows a error when being started in a background service.
This seems to be related to the V2 embedding.

Old (and correct) behavior

No crash on V1 embedding.

Current behavior

2020-03-31 22:30:26.265 15821-15821/com.mynextbase.connect E/MethodChannel#flutter.baseflow.com/google_api_availability/methods: Failed to handle method call
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
        at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(Unknown Source:12)
        at com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable(Unknown Source:5)
        at com.google.android.gms.common.GoogleApiAvailability.isGooglePlayServicesAvailable(com.google.android.gms:play-services-base@@17.1.0:96)
        at com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable(Unknown Source:3)
        at com.google.android.gms.common.GoogleApiAvailability.isGooglePlayServicesAvailable(com.google.android.gms:play-services-base@@17.1.0:95)
        at com.baseflow.googleapiavailability.GoogleApiAvailabilityPlugin.onMethodCall(GoogleApiAvailabilityPlugin.java:105)
        at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
        at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
        at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:336)
        at android.os.Looper.loop(Looper.java:174)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Reproduction steps

Run the plugin in a background service.

Configuration

Version: 2.0.3

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

The implementation of the V2 embedding seems a little complicated.
The applicationContext should always be available to the GoogleApiAvailabilityPlugin class, and "activity" could be set depending on whether the activity has been connected or not.

The check

      if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (showDialog != null && showDialog) {
          googleApiAvailability.showErrorDialogFragment(activity, connectionResult, REQUEST_GOOGLE_PLAY_SERVICES);
        }
      }

could then be replaced by "if (activity != null)".

Please return support IOS platform

I use this library in common Dart code on two platforms and after upgrading to 5.0.0 in runtime there is an error

๐Ÿš€ Feature Requests

Contextualize the feature

Describe the feature

Platforms affected (mark all that apply)

  • [x ] ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

[Bug]: MissingPluginException on Flutter 3.19.6

Please check the following before submitting a new issue.

Steps to reproduce

paste the code given below

Expected results

it checks for availability

Actual results

it fails with error

Code sample

Code sample
if (Platform.isAndroid) {
      GooglePlayServicesAvailability availability =
          await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
      log.d(availability.value);
    }

Screenshots or video

Screenshots or video demonstration image

Version

5.0.0

Flutter Doctor output

Doctor output
[โœ“] Flutter (Channel stable, 3.19.6, on macOS 13.0.1 22A400 darwin-arm64, locale ru-RU)
    โ€ข Flutter version 3.19.6 on channel stable at /Users/svmolchan1/fvm/versions/stable
    โ€ข Upstream repository https://github.com/flutter/flutter.git
    โ€ข Framework revision 54e66469a9 (2 weeks ago), 2024-04-17 13:08:03 -0700
    โ€ข Engine revision c4cd48e186
    โ€ข Dart version 3.3.4
    โ€ข DevTools version 2.31.1

[โœ“] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    โ€ข Android SDK at /Users/svmolchan1/Library/Android/sdk
    โ€ข Platform android-34, build-tools 34.0.0
    โ€ข Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    โ€ข Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    โ€ข All Android licenses accepted.

[โœ“] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    โ€ข Xcode at /Applications/Xcode.app/Contents/Developer
    โ€ข Build 14E300c
    โ€ข CocoaPods version 1.14.3

[โœ“] Chrome - develop for the web
    โ€ข Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[โœ“] Android Studio (version 2023.2)
    โ€ข Android Studio at /Applications/Android Studio.app/Contents
    โ€ข Flutter plugin can be installed from:
      ๐Ÿ”จ https://plugins.jetbrains.com/plugin/9212-flutter
    โ€ข Dart plugin can be installed from:
      ๐Ÿ”จ https://plugins.jetbrains.com/plugin/6351-dart
    โ€ข Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[โœ“] VS Code (version 1.88.1)
    โ€ข VS Code at /Applications/Visual Studio Code.app/Contents
    โ€ข Flutter extension version 3.86.0

[โœ“] Connected device (3 available)
    โ€ข M2101K9AG (mobile) โ€ข cc706425 โ€ข android-arm64  โ€ข Android 13 (API 33)
    โ€ข macOS (desktop)    โ€ข macos    โ€ข darwin-arm64   โ€ข macOS 13.0.1 22A400 darwin-arm64
    โ€ข Chrome (web)       โ€ข chrome   โ€ข web-javascript โ€ข Google Chrome 120.0.6099.216

[โœ“] Network resources
    โ€ข All expected network resources are available.

โ€ข No issues found!

Type inference failed. Expected type mismatch: inferred type is Boolean? but Boolean was expected

๐Ÿ› Bug Report

kotlin_version = '1.2.30'

Launching lib/main.dev.dart on ONEPLUS A6000 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDevDebug'...
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/sandeeepcmsm/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.2.1+2/android/src/main/java/com/flutter_webview_plugin/WebviewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/sandeeepcmsm/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.2.1+2/android/src/main/java/com/flutter_webview_plugin/WebviewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
e: /Users/sandeeepcmsm/.pub-cache/hosted/pub.dartlang.org/google_api_availability-1.0.2/android/src/main/kotlin/com/baseflow/googleapiavailability/GoogleApiAvailabilityPlugin.kt: (29, 48): Type inference failed. Expected type mismatch: inferred type is Boolean? but Boolean was expected

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':google_api_availability:compileDebugKotlin'.

Compilation error. See log for more details

Reproduction steps

Configuration

Doctor summary (to see all details, run flutter doctor -v):
[โœ“] Flutter (Channel master, v0.9.7-pre.35, on Mac OS X 10.14 18A391, locale en-IN)
[โœ“] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[โœ“] iOS toolchain - develop for iOS devices (Xcode 10.0)
[โœ“] Android Studio (version 3.2)
[!] IntelliJ IDEA Community Edition (version 2018.1.5)
โœ— Flutter plugin not installed; this adds Flutter specific functionality.
โœ— Dart plugin not installed; this adds Dart specific functionality.
[โœ“] VS Code (version 1.27.2)
[โœ“] Connected device (2 available)

! Doctor found issues in 1 category.
Version: 1.x

Platform:

  • ๐Ÿค– Android

MissingPluginException

๐Ÿ› Bug Report

I installed the package and imported it like this:

import 'package:google_api_availability/google_api_availability.dart';

Then in an async function I did this:

final availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability(true);

When I called function while running in an Android emulator I got this error:

ERROR:flutter[/lib/ui/ui_dart_state.cc]()(209)] Unhandled Exception: MissingPluginException(No implementation found for method checkPlayServicesAvailability on channel flutter.baseflow.com[/google_api_availability/methods]()

Expected behavior

I expected no error and an indication of whether the Google Play services are available.

Configuration

Version: 3.0.1

Platform:

  • ๐Ÿ“ฑ iOS
  • ๐Ÿค– Android

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.