flutter_bluetooth_serial icon indicating copy to clipboard operation
flutter_bluetooth_serial copied to clipboard

App crashes on Android 12 or after!

Open savitore opened this issue 2 years ago • 5 comments
trafficstars

Problem summary

When we add the Bluetooth connectivity to the app and visit the screen that contains the connection, the app crashes if the android mobile has Android 12 or after. The connection works fine for Android 11 or before. There might be some permissions problem, but I've tried adding every Bluetooth permission, and it still doesn't work.

savitore avatar Jul 15 '23 08:07 savitore

try to add ACCESS_FINE_LOCATION

Fouad-Asil avatar Aug 18 '23 11:08 Fouad-Asil

added that, didn't work:)

savitore avatar Aug 18 '23 11:08 savitore

Try this

<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" /> <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" /> <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />

dotupNET avatar Aug 30 '23 11:08 dotupNET

Having the same Issue here.

When the permissions page pop up and they are granted, the app crashes. However, when the permissions are denied, everything's fine.

Tested with the current manifest:

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<!-- Needed only if your app looks for Bluetooth devices.
         If your app doesn't use Bluetooth scan results to derive physical
         location information, you can strongly assert that your app
         doesn't derive physical location. -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<!-- Needed only if your app makes the device discoverable to Bluetooth
  devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<!-- Needed only if your app communicates with already-paired Bluetooth
       devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<!--bibo01 : hardware option-->
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

GabLast avatar Sep 08 '23 15:09 GabLast

Bump. Any update on this issue? This is quite critical issue, as it is drawing plugin unusable on Android 12+.

xtensa avatar Oct 09 '23 08:10 xtensa