How listener for Permissions change with capacitor



  • I need to watch when Permissions change, in case the user change the permission mannualy in configurations. In Capacitor documentation of Permissions is mencioned the method addListener, but with no examples or list of possible listeners:

    addListener(eventName: string, listenerFunc: Function): PluginListenerHandle
    

    I try various string in eventName, but no one works. Someone can help?



  • @jonathan_on you cant listen to it if the user did it manually in the settings afaik (for security reasons), but you can check it within your app if you’re missing a permission, the way permission works now differently and it varies on the api lvl of your os. New ones now are shown on demand within the app and i think that’s how capacitor’s permission api works. So what you could do is just check it in your app and show a permission dialog for the ones that are not permitted yet, or check it on demand when the user goes to the page where your app needs permission.


Log in to reply