bkonyi / FlutterGeofencing

Rough work for Flutter geofencing plugin
BSD 3-Clause "New" or "Revised" License
337 stars 219 forks source link

Failed to add geofence: com.google.android.gms.common.api.ApiException: 1004: #72

Open JuniorEC opened 3 years ago

JuniorEC commented 3 years ago

I added geofence in my app similar to the example in this repository and I'm getting the following error: W/ConnectionTracker( 7947): Exception thrown while unbinding W/ConnectionTracker( 7947): java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzji@84ae46d W/ConnectionTracker( 7947): at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757) W/ConnectionTracker( 7947): at android.app.ContextImpl.unbindService(ContextImpl.java:1874) W/ConnectionTracker( 7947): at android.content.ContextWrapper.unbindService(ContextWrapper.java:792) W/ConnectionTracker( 7947): at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55) W/ConnectionTracker( 7947): at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50) W/ConnectionTracker( 7947): at com.google.android.gms.measurement.internal.zzio.zzag(com.google.android.gms:play-services-measurement-impl@@17.6.0:245) W/ConnectionTracker( 7947): at com.google.android.gms.measurement.internal.zzio.zzal(com.google.android.gms:play-services-measurement-impl@@17.6.0:262) W/ConnectionTracker( 7947): at com.google.android.gms.measurement.internal.zzio.zzc(com.google.android.gms:play-services-measurement-impl@@17.6.0:336) W/ConnectionTracker( 7947): at com.google.android.gms.measurement.internal.zzir.zza(com.google.android.gms:play-services-measurement-impl@@17.6.0:2)

My AndroidManifest: `

`

Flutter doctor: `

flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [versão 10.0.18363.1198], locale pt-BR) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.2) X Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. [!] Android Studio (not installed) [√] VS Code, 64-bit edition (version 1.51.1) [√] Connected device (1 available) `

DevarshRanpara commented 3 years ago

Hi @JuniorEC , I was having same issues. Error code 1004 mens app does not have enough permissions to operate, and that's why you are having that issue. For refrence check this out. You will need to add <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> permission in your app. You can use location_permissions plugin to get location permissions. Make sure your app have background location permission.