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

lint Error with TargetSdkVersion 33: Posting a permission requires holding the POST_NOTIFICATIONS permission. #2354

Open
JohannesTeichert opened this issue Feb 17, 2023 · 2 comments

Comments

@JohannesTeichert
Copy link

JohannesTeichert commented Feb 17, 2023

I am getting this error when executing lintDebug gradle task:

Error: When targeting Android 13 or higher, posting a permission requires holding the POST_NOTIFICATIONS permission (usage from com.squareup.picasso.RemoteViewsAction.NotificationAction) [NotificationPermission]

   Explanation for issues of type "NotificationPermission":
   When targeting Android 13 and higher, posting permissions requires holding
   the runtime permission android.permission.POST_NOTIFICATIONS.

I have target targetSdkVersion 33 and I am running ./gradlew lint.

Should picasso include the permission or the depending app?

@chiragcode11
Copy link

chiragcode11 commented Dec 19, 2023

In API 33 we need runtime permission for push notification.

in app level:
uses-permission android:name="android.permission.POST_NOTIFICATIONS

you can trigger the prompt using this:

pushNotificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)

handle notification result:

private val pushNotificationPermissionLauncher = registerForActivityResult(RequestPermission()) { granted ->
viewModel.inputs.onTurnOnNotificationsClicked(granted)
}

@ArafathDigital
Copy link

ArafathDigital commented May 9, 2024

I am getting this error. I am not using any Notification in the app, now if I aks user for the permission, that will be confusing for the user right ? Is there any other fix for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants