Skip to content

Conversation

@mahibi
Copy link
Collaborator

@mahibi mahibi commented Jan 29, 2026

lint gives:

"Missing foregroundServiceType attribute in manifest
To call Service.startForeground(), the element of manifest file must have the foregroundServiceType attribute specified"

for the lines
CallForegroundService.kt:40
CallForegroundService.kt:42

However the AndroidManifest contains the foregroundServiceType for this class:

    <service
        android:name=".services.CallForegroundService"
        android:exported="false"
        android:foregroundServiceType="microphone|camera" />

For
startForeground(NOTIFICATION_ID, notification, foregroundServiceType)
i guess it's just a lint problem to not recognize that the service types are passed as variable.

For
startForeground(NOTIFICATION_ID, notification)
i guess lint is not able to take into account the android version check where it's not necessary to pass a service type.

So i will suppress the lint warnings.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

…ze them?)

lint gives:

To call Service.startForeground(), the <service> element of manifest file must have the foregroundServiceType attribute specified

for the lines
CallForegroundService.kt:40
CallForegroundService.kt:42

However the AndroidManifest contains the foregroundServiceType for this class:

        <service
            android:name=".services.CallForegroundService"
            android:exported="false"
            android:foregroundServiceType="microphone|camera" />

For
 startForeground(NOTIFICATION_ID, notification, foregroundServiceType)
i guess it's just a lint problem to not recognize that the service types are passed as variable.

For
 startForeground(NOTIFICATION_ID, notification)
i guess lint is not able to take into the android version check where it's not necessary to pass a service type.

So i will suppress the lint warnings.

Signed-off-by: Marcel Hibbe <[email protected]>
@mahibi mahibi self-assigned this Jan 29, 2026
@github-actions
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5769.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings99104
Errors00

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1010
Dodgy code5454
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total8181

Lint increased!

@mahibi mahibi added the 3. to review Waiting for reviews label Jan 29, 2026
@mahibi mahibi added this to the 23.1.0 milestone Jan 29, 2026
@mahibi mahibi requested a review from rapterjet2004 January 29, 2026 12:10
@mahibi
Copy link
Collaborator Author

mahibi commented Jan 29, 2026

errors are "gone"

@mahibi mahibi merged commit 80207cc into master Jan 29, 2026
14 of 18 checks passed
@mahibi mahibi deleted the bugfix/noid/suppressLintForegroundServiceTypeWarning branch January 29, 2026 12:19
@mahibi
Copy link
Collaborator Author

mahibi commented Jan 29, 2026

/backport to stable-23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants