Skip to content

Commit 87fda16

Browse files
committed
android: support check bluetooth permission for api 31
1 parent 73dfce9 commit 87fda16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/zxcpoiu/incallmanager/AppRTC/AppRTCBluetoothManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.content.IntentFilter;
2222
import android.content.pm.PackageManager;
2323
import android.media.AudioManager;
24+
import android.os.Build;
2425
import android.os.Handler;
2526
import android.os.Looper;
2627
import android.os.Process;
@@ -226,7 +227,8 @@ public State getState() {
226227
*/
227228
public void start() {
228229
Log.d(TAG, "start");
229-
if (!hasPermission(apprtcContext, android.Manifest.permission.BLUETOOTH)) {
230+
String p = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? android.Manifest.permission.BLUETOOTH_CONNECT : android.Manifest.permission.BLUETOOTH;
231+
if (!hasPermission(apprtcContext, p)) {
230232
Log.w(TAG, "Process (pid=" + Process.myPid() + ") lacks BLUETOOTH permission");
231233
return;
232234
}

0 commit comments

Comments
 (0)