Potential Permissions Problems

Hi Peter,

of course, this cannot work, since there are no components that require these permissions and therefore they were not declared in the Manifest.

These are the permissions declared in the Manifest in your app:
<uses-permission android: name = "android.permission.INTERNET" />
<uses-permission android: name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android: name = "android.permission.ACCESS_WIFI_STATE" />
<uses-permission android: name = "android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android: name = "android.permission.WRITE_EXTERNAL_STORAGE" />

These are missing:
<uses-permission android: name = "android.permission.WRITE_CALENDAR" />
<uses-permission android: name = "android.permission.READ_CALENDAR" />

You cannot request permissions without declaring them in the Manifest !

So you have to insert the components first to add these permissions to the Manifest and then call a function / method on Screen.Initialize.

Check this:
permissionsTest3.aia (105.7 KB)


1 Like

Hi Anke,
Thank you. I had misunderstood because the request WRITE_EXTERNAL_STORAGE worked whereas WRITE_CALENDAR and READ_CALENDAR didn't. The list you supplied of default permissions declared in the Manifest and your explanation were most helpful. And your aia showed me how multiple requests in the initialisation block can be called in sequence.

This leaves the question. Is there a critical requirement for the location sensor to request a permission just prior to Screen’s Initialize event. Or because it can interfere with a permission requested in the initialise event should the location sensor permission be moved to where it is first needed?

The example below has a ten second delay in Screen.Initialise before it calls for a WRITE_EXTERNAL_STORAGE permission request. If the location sensor's request for ACCESS_FINE_LOCATION permission is granted within ten seconds the WRITE_EXTERNAL_STORAGE permission request appears. If the location sensor's request is granted later than ten seconds delay the WRITE_EXTERNAL_STORAGE permission request doesn't appear demonstrating the interference mechanism.

PermissionTest5.aia (21.9 KB)


Regards, Peter

You should move it where it is first needed. The LocationSensor component requests permission due to its Enabled property being set to true. If you change it to false in the designer it won't prompt on startup. Then you can enable it in the blocks at the appropriate time and it will request permission at that point.

Properties of components are set before Screen1.Initialize is called, which is why you see it in the observed order.

2 Likes

Hi

Thanks to both EWPatton and Anke for their patience with all my questions and for their clear explanations and examples. They have made sense of a lot of what I was trying to understand. And of course that last instruction worked perfectly!

Greatly appreciated, Peter

3 Likes

Yes thanks, and I also learned something.

3 Likes