FlutterMidiCommand
FlutterMidiCommand copied to clipboard
android.permission.BLUETOOTH_SCAN needs to be approved by the user for Android12+
When build with targetSdkVersion 31 and run on Android 12 the app crashes, after approving the location permissions by the user. The reason seems to be that the permission android.permission.BLUETOOTH_SCAN is not requested in FlutterMidiCommandPlugin at all.
See android documentation for the changed requirements: https://developer.android.com/guide/topics/connectivity/bluetooth/permissions
A workaround is to set targetSdkVersion of the app to a maximum of 30 (Android 11). Then the legacy layer avoid the app crash and the permissions are correctly handled.