Baseflow / flutter-geolocator

Android and iOS Geolocation plugin for Flutter
https://baseflow.com/
MIT License
1.24k stars 645 forks source link

[Question]: Incorrect foreground service type From Android 14 - Publishing overview - Play Store #1564

Open Luis-Leonidas-Fernandez opened 4 weeks ago

Luis-Leonidas-Fernandez commented 4 weeks ago

Please check the following before submitting a new issue.

Please select for which platform(s) you need help

Your question

Incorrect foreground service type From Android 14, developers must specify service types when foreground services are found in their app's manifest. Starting services with different types may cause your app to crash.

Your app's manifest declares com.baseflow.geolocator.GeolocatorLocationService, which starts in the foreground in the following place:

com.baseflow.geolocator.GeolocatorLocationService.com.baseflow.geolocator.GeolocatorLocationService.f Make sure that service types passed to startForeground() match what is specified in your app's manifest.

geolocator: ^13.0.1

Captura

play store msg

Version

13.0.1

Luis-Leonidas-Fernandez commented 4 weeks ago

manifest

TimHoogstrate commented 3 weeks ago

Duplicate: https://github.com/Baseflow/flutter-geolocator/issues/1558

mvanbeusekom commented 14 hours ago

Hi @Luis-Leonidas-Fernandez ,

The geolocator plugin should automatically add the correct <service ../> element to the applications manifest file when the application is compiled into an appbundle or apk file.

Easiest way to validate this is by analyzing the .apk using Android Studio:

  1. Make sure to build an .apk of your application.
  2. Open Android Studio and go to "Build" -> "Analyze APK" (no need to open a project first).
  3. Next navigate to the .apk file that you just build and is should show the final AndroidManifest file for your application.

In my tests the application contains the following service declaration (note that there was no need for me to add this myself to the AndroidManifest.xml file):

        <service
            android:name="com.baseflow.geolocator.GeolocatorLocationService"
            android:enabled="true"
            android:exported="false"
            android:foregroundServiceType="0x8" />

The value 0x8 translates to the location enum value as documented here: https://developer.android.com/reference/android/R.attr#foregroundServiceType

Can you verify if this is also the case for your application. If you add your own <service ... /> declaration please try to remove it. Or if the declaration in missing in your final AndroidManifest.xml file please try adding it manually in the android/app/src/main/AndroidManifest.xml by copy/ pasting the above XML.

Please let me know if this helped.