File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
android/capacitor/src/main/java/com/getcapacitor/plugin
ios/Capacitor/Capacitor/Plugins Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ public void query(PluginCall call) {
37
37
case "clipboard-read" :
38
38
case "clipboard-write" :
39
39
checkClipboard (call );
40
+ case "microphone" :
41
+ checkMicrophone (call );
40
42
break ;
41
43
default :
42
44
call .reject ("Unknown permission type" );
@@ -80,4 +82,8 @@ private void checkClipboard(PluginCall call) {
80
82
call .resolve (ret );
81
83
}
82
84
85
+ private void checkMicrophone (PluginCall call ) {
86
+ checkPerm (Manifest .permission .RECORD_AUDIO , call );
87
+ }
88
+
83
89
}
Original file line number Diff line number Diff line change @@ -1348,7 +1348,8 @@ export enum PermissionType {
1348
1348
Geolocation = 'geolocation' ,
1349
1349
Notifications = 'notifications' ,
1350
1350
ClipboardRead = 'clipboard-read' ,
1351
- ClipboardWrite = 'clipboard-write'
1351
+ ClipboardWrite = 'clipboard-write' ,
1352
+ Microphone = 'microphone'
1352
1353
}
1353
1354
1354
1355
export interface PermissionsOptions {
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public class CAPPermissionsPlugin: CAPPlugin {
25
25
return checkClipboard ( call)
26
26
case " photos " :
27
27
return checkPhotos ( call)
28
+ case " microphone " :
29
+ return checkMicrophone ( call)
28
30
default :
29
31
return call. reject ( " Unknown permission type " )
30
32
}
@@ -108,4 +110,22 @@ public class CAPPermissionsPlugin: CAPPlugin {
108
110
" state " : " granted "
109
111
] )
110
112
}
113
+
114
+ func checkMicrophone( _ call: CAPPluginCall ) {
115
+ let microStatus = AVCaptureDevice . authorizationStatus ( for: . audio)
116
+
117
+ var ret = " prompt "
118
+ switch ( microStatus) {
119
+ case . authorized:
120
+ ret = " granted "
121
+ case . denied, . restricted:
122
+ ret = " denied "
123
+ case . notDetermined:
124
+ ret = " prompt "
125
+ }
126
+
127
+ call. resolve ( [
128
+ " state " : ret
129
+ ] )
130
+ }
111
131
}
You can’t perform that action at this time.
0 commit comments