Permissions on first app startup

something i've just dealt with to this point but could be done better im sure:

I use the location sensor, which on first app use pops a location permission automatically - all well and good.
now, I also need to pop the permission for bluetooth which needs to be done manually in the blocks now.
id like to pop these back to back, like after location permission is granted or denied, it auto pops the BT permissions. currently i have tried the if granted and the denied function and it doesnt seem to catch the location sensor - so inevitably what happens now on first boot is the location pops, you accept, then you have to close the app, reopen it, and then BT pops. (like they dont like popping at same time and are trying to)

ive used ACCESS_FINE_LOCATION as a permission granted trigger without any success.
just trying to pop these back to back and im assuming im not looking for the right permission that auto runs in the background of location sensor.

id like to either suppress location sensor permission until I call it in the blocks, or find the appropriate permission command to chain off of.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

this must not be the correct location sensor permission, because it doesnt catch it and cascade to the next permission.
again, location sensor via MIT app inventor auto pops a permission on the backend where BT stuff now has to be manually called in the blocks via developer

your screenshot unfortunately is of bad quality

To get an image of a block, right click onto that block and select "Download Blocks as PNG".
Then post it here in the community.

Taifun


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

The way you request FINE_LOCATION for devices Android 11+ is not correct.

You might try this example that might work in your situation to set FineLocation permission.

Does it fix your Bluetooth issue? I don't know. :cry:

Try this:

its something associated with the location sensor auto popping the fine permission on the backend. I dont request fine_location anywhere in the program, its hard coded to the location sensor to ask for the permission - it activates itself. so as soon as you open the app, it hits you with it regardless of if you want it to or not.

thought "okay, fine - I'll just use it to trigger my next permission". nope, sure doesnt work for whatever reason.
now, I call the BT permission elsewhere again anyway and it works, its just a clunky workaround that shouldnt haver to be that way. should be able to just cascade them ...

the below image does not call BLUETOOTH_CONNECT or print "potato" after allowing fine location permission. even though the fine location permission is asked and accepted. again, nowhere do i call for location permission, location sensor just being in the app immediately calls it.

click on the image

No, the location permission(s) is (are) only requested if the LocationSensor is enabled in the Designer. If it is enabled the permission is requested automatically and the PermissionGranted event is not triggered.

So disable it in the Designer and ask for permission manually (e.g. in the Screen.Initialize event). Then the PermissionGranted event is triggered and you can request (an)other permission(s) there.

See also here:

1 Like