An App I’m preparing for publication requires both file and Bluetooth low energy operations. The app works without any issues when I apply the required permissions manually or when I automate either one or other of the permissions using the Screen1.AskForPermission in the initialise Screen1 method. If I try to include both permissions I have to initialise Screen1 twice by starting the Screen1 page twice.
The semi-automated approach initialising each from a list picker works well, but I’d like to be sure that I’m not missing something obvious. Is there a way for Screen1 to request multiple permissions with a single Screen1 initialisation?
Thanks Anke that link gave me all the information I needed towards the end of the thread.
I’ll add the permissions to a dropdown list (ListPicker) that I’m already using for selecting screen pages and describe it in the ReadMe document.
EDIT: sorry, that solution uses some blocks, which are not avaialble in MIT App Inventor...
In a perfect App Inventor world you do not have to ask for any permission manually... before any permission is required, it should be asked for that permission automatically...
I haven’t played with permissions before, but
from what I have read in these two threads this might
work well with a pre-built queue of permissions,
requested one by one at a time.
Sample template (with probably wrong permission orders) …
Yesterday one of many approaches I tried was the simple one of putting an ask for permission statement into the permission granted block see image below, This was another one of many I tried that didn’t seem to work. I noticed also it was similar to an issue that you had raised in the link you suggested.
Today I find that the approach does now work. I don’t know whether I made a mistake yesterday somewhere. But to day it seems the solution to multiple automatic permission requests is very straightforward.
If I did make a mistake yesterday then apologies to all and I’ll post this also in the related enquiry.
P.S. The example above is of course not a full implementation but just to make the point that the ability to write conditional calls for permission in PermissionGranted and PermissionNotGranted blocks makes the automation task feasible and straightforward.
Copied below is my implementation for a project with two BLE’s and a set of external files. It shows a pair of requests for permissions in the Screen1 initialisation that are not intended to work together. They are intended to work alternately depending on whether one permission or the other is already in place. If neither are in place then the first permission (for access to location) is triggered by the Screen1 initialisation and the second (write to storage) is triggered by the Permission Granted block. I’m not sure if the approach could be expanded to more permissions by cascading the requests I think it would depend on whether the multiple permission granted blocks can be called recursively and whether they are held in a stack somewhere.