• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android / Amazon Fire os_request_permission issue [solved]


I am trying to request a permission at runtime using

but the requester does not appear. Can somebody please confirm this?


ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
The documentation suggests that WRITE_EXTERNAL_STORAGE can be requested via Game Options instead, so perhaps it does not appear if you've asked for it there?
It is worth noting that the following permission are supported natively by GameMaker Studio 2, but are considered "dangerous" by Google and as such they must be explicitly requested (note too that some permissions can be requested using the Android Game Options without the need for this function):
  • android.permission.WRITE_EXTERNAL_STORAGE
  • android.permission.READ_PHONE_STATE
  • android.permission.RECORD_AUDIO



I also tried to check the permission checkboxes in the Game Options, however I still need to request the permission at runtime (just before I need to access the external storage) so I need to use the os_request_permission function.
From API 23 (I am targeting 29) permissions should be granted at runtime instead of installtime, so I just cannot use the Game Options for this.

I've made more investigation and found the os_check_permission function returns -1 so the following condition will never will be true as os_permission_denied constant is 0:

if os_check_permission("android.permission.WRITE_EXTERNAL_STORAGE") == os_permission_denied

Instead I am using:

if os_check_permission("android.permission.WRITE_EXTERNAL_STORAGE") != os_permission_granted
Now the requester seems to be fine.