How to check if "Home screen shortcuts" permission was granted?

90 Views Asked by At

I want to add a Glance widget to the home screen directly from the app.

When I request to pin the widget, it prompts the user for permission. If the user denies it and then tries to pin the widget again, nothing will happen. I'd like to open the app settings so they can manually grant the necessary permission.

The problem is that I don't know the specific permission name, so I can't check if it was granted or not. I tried using INSTALL_SHORTCUT, but it's always in a Denied state even when the user has granted the required permission.

// request to pin the widget
GlanceAppWidgetManager(context).requestPinGlanceAppWidget(
    receiver =  TrackerWidgetReceiver::class.java
)

Permission in settings

Permission asking

0

There are 0 best solutions below