View Issue Details

IDProjectCategoryView StatusLast Update
0030373RunnerAndroidPublic2019-01-30 16:20
ReporterStewart BishopAssigned ToMike Rennie 
PriorityMediumSeverityB - MajorReproducibility100%
Status ClosedResolutionFixed 
PlatformAndroidOSAndroidOS Version
Product Version2.2.1 
Target Version2.2.2Fixed in Version2.2.2 
Summary0030373: Android: Audio recording doesn't work
DescriptionCreated a sample to test audio recording and playback, which works as expected on Native, but on Android this will do nothing and throw you two errors:

01-07 15:12:23.656 4353 4379 I yoyo : get configuration interface - Feature unsupported
01-07 15:12:23.660 4353 4379 I yoyo : recorder Realize - Content unsupported
Steps To Reproduce1) Plug in a microphone to your PC
2) Run the sample on Windows
3) Press Record
4) Make some noise or talk
5) Press Play
6) Hear your sound played back as expected
7) Run the sample on Android
8) Press Record
9) See that the queue length doesn't increment and the errors appear in your ABD log
Tagsandroid, Runner
1.4 Found In
2.x Runtime Found In2.2.2.293
2.x Runtime Verified In2.2.2.302

Activities

Stewart Bishop

2019-01-07 15:28

Developer  

RecordAudioQueue.yyz (68,152 bytes)

Mike Rennie

2019-01-11 15:56

Developer   ~0062440

Last edited: 2019-01-14 10:40

View 2 revisions

I've attached a modified version of the sample which shows how to check for and request audio recording permissions on Android using the os_check_permission() and os_request_permission() functions.

<Removed old version as attached new version below>

Mike Rennie

2019-01-11 16:07

Developer   ~0062441

In order to support audio recording on newer versions of Android permission must be explicitly given by the user. It turns out that we already had support for doing this but the functions were not exposed in the IDE, which I've now done.


The functions are:

- os_check_permission(permission) - this checks whether the specified permission is allowed and returns either 1, which means that permission is allowed, 0, which means that permission is denied, or -1, which means that permission is denied and furthermore shouldn't be requested. In the case of audio recording the permission to request is "android.permission.RECORD_AUDIO".

- os_request_permission(permission) - this shows an OS dialog which asks the user whether they wish to grant the specified permission. When the user responds it triggers an async System event. Within this system event a ds_map called "async_load" is available, which has a key called "type", which has the associated value "permission_request_result". There will also be a key which matches the name of the permission requested (in the sample this is "android.permission.RECORD_AUDIO") which will have a value of 0 if permission is allowed, or -1 if permission is denied.

Mike Rennie

2019-01-14 10:43

Developer   ~0062448

I have now added some new GML constants to make this more user-friendly (and updated the sample appropriately):

- "os_permission_granted" - indicates that permission has been granted
- "os_permission_denied" - indicates that permission has been denied
- "os_permission_denied_dont_request" - indicates that permission has been denied, and either the user has selected "Dont ask again" or permission is blocked by the device settings

RecordAudioQueue_requestpermissions.yyz (76,716 bytes)

Stewart Bishop

2019-01-29 15:34

Developer   ~0062554

I've attached a slightly more Android friendly sample for anyone else that wants to use the above sample to implement, just adds some buttons rather than relying on mouse presses.

RecordAudioQueue_requestpermissions-2.yyz (83,022 bytes)