Are multiple Screen1.AskForPermissions possible for a single screen initialisation event

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?

Regards, Peter

image
image

1 Like

See here:
https://groups.google.com/forum/#!searchin/mitappinventortest/permission$20screen.initialize|sort:date/mitappinventortest/UiIfA0mgXV4/Q9fS5NzoDAAJ

1 Like

Hi Anke,

Maybe you could make a guide in this community from that topic? It will help a lot of users.

2 Likes

Maybe later, at the moment I don't have time.

3 Likes

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.

Regards, Peter

2 Likes

yes, see here

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...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

2 Likes

Yes, therefore my final remark on my challange:

2 posts were split to a new topic: Potential Permissions Problems

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) …

continue_initialization global DENIED_PERMISSIONS permission_request_queue.aia (3.2 KB) when Screen1 Initialize when Screen1 PermissionDenied when Screen1 PermissionGranted

3 Likes

Hi Anke,

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.

Regards, Peter

image

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.
image
image

Regards, Peter

1 Like