Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 of 8 tasks
developerflutter opened this issue Aug 17, 2024 · 7 comments
Assignees
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue.

Comments

@developerflutter
Copy link

Please check the following before submitting a new issue.

Please select for which platform(s) you need help

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

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

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

Version

13.0.1

@Luis-Leonidas-Fernandez

I have the same problem, I still don't know how to solve it.

@TimHoogstrate
Copy link
Contributor

Dear @developerflutter,

When do you see this message? Is this message coming from the play store?

Kind regards,

@TimHoogstrate TimHoogstrate added the status: needs more info We need more information before we can continue work on this issue. label Aug 19, 2024
@developerflutter
Copy link
Author

developerflutter commented Aug 20, 2024

image

image

Yes it's in Publishing overview.
Screenshots attached.

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Aug 20, 2024
@TimHoogstrate TimHoogstrate self-assigned this Aug 20, 2024
@TimHoogstrate
Copy link
Contributor

Dear @developerflutter,

Can you paste the contents of your app manifest to this issue? It helps a lot investigating and resolving this issue.

Kind regards,

@TimHoogstrate TimHoogstrate added the status: needs more info We need more information before we can continue work on this issue. label Aug 20, 2024
@developerflutter
Copy link
Author

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>

<service
        android:name="id.flutter.flutter_background_service.BackgroundService"
        android:foregroundServiceType="location"
 />

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Aug 20, 2024
@mvanbeusekom mvanbeusekom self-assigned this Sep 2, 2024
@mvanbeusekom
Copy link
Member

Hi @developerflutter,

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.

@mvanbeusekom mvanbeusekom added status: needs more info We need more information before we can continue work on this issue. platform: android Issue is related to the Android platform. P2 Important issues not at the top of the work list. labels Sep 20, 2024
Copy link

github-actions bot commented Oct 4, 2024

Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.

@github-actions github-actions bot added the status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. label Oct 4, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue.
Projects
None yet
Development

No branches or pull requests

4 participants