Ask Privacy Permissions Electron js MAC
Electron js is one of the most powerful and simple technologies to create cross-platform desktop applications while creating desktop apps we need some extra details about computers. In windows as of now, there are no restrictions over using hardware modules or some extra information. But in MAC os sometimes we need a camera, microphone, screen recording, accessibility, etc permissions by default it is restricted for applications because of security purposes. When developing electron js apps for mac we need to take care of those conditions. If you don't ask for permissions at the beginning it will ask permission in-app when you will use that service
E.g if you don't ask for camera permission at the beginning mac will automatically ask for permission during the run time but it's not good as per user experience imagine you are working on the application and it disturbed you in between with popup. A better way is to ask permission right at the beginning.
Understanding MAC permissions pattern
If you are installing an app for the first time it will generate a popup asking for permission but if you have installed it and removed it .it will unlist your app from the privacy list. If you reinstall the app now, if you are expecting that it will ask permission with a popup then this will not happen because your app is already added to the privacy policy database of your machine and this time it will simply bring the privacy settings window in focus and lands you on the particular permission checkbox.
tccutil reset All your_app_package_name
This command will reset all permissions for the app packager you have given
You can use the npm package to check and ask if permissions are given or not https://www.npmjs.com/package/node-mac-permissions
0 Comments