tchvu3 / capacitor-voice-recorder

Capacitor plugin for voice recording
MIT License
75 stars 61 forks source link

(android) Fix recording permissions request #29

Closed dragermrb closed 1 year ago

dragermrb commented 1 year ago

Hi!

On android, the requestAudioRecordingPermission() method does not return the expected response. Instead, it returns something like this:

{"voice recording": "granted"}

The reason is that the recordAudioPermissionCallback() method is never called because requestPermissions(call) it is used. Using a proper ´requestPermissionForAlias(...)´ fix the issue.

mepc36 commented 1 year ago

@tchvu3 Any chance we could get this fix merged in?

In the mean time, here is what is returned on each platform when the perm is approved/denied:

              // TODO: handle both iOS and android
              // android granted: { "voice recording": "granted" }
              // android not granted: { "voice recording": "denied" }
              // ios granted: 
              // ios not granted: 

Choosing "While using app" or "only once" does not change the above; they both return "granted". The ios ones are not filled out b/c my XCode died on me but I'm 95% sure that they do return { value: true } and {value: false, as the docs describe.