Coder Social home page Coder Social logo

Comments (6)

eliezedeck avatar eliezedeck commented on June 25, 2024 5

Android 12 doesn't work initially. You'll have to follow this: https://stackoverflow.com/questions/70578601/android-12-ble-scan-does-not-find-any-devices

As a result, I had these in the Android manifest file:

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

Then I request the following permissions at runtime:

await Permission.bluetoothConnect.request();
await Permission.bluetoothScan.request();
await Permission.locationWhenInUse.request();

from esc_pos_bluetooth.

iyashiyas avatar iyashiyas commented on June 25, 2024 1

solved the issue with adding permission from flutter also added android manifest.xml

var statusLocation = Permission.location;
var statusScan = Permission.bluetoothScan;
var statusConnect = Permission.bluetoothConnect;
if (Platform.isAndroid) {
if (await statusLocation.isDenied) {
await [
Permission.location,
].request();
}

    if (await statusLocation.isGranted &&
      await statusScan.isGranted &&
      await statusScan.isGranted) {
    commonPrint('all grnted');
    // do scan bluetooth device function
  }

from esc_pos_bluetooth.

ferns-it avatar ferns-it commented on June 25, 2024

Same issue, any solutions ??

from esc_pos_bluetooth.

jobypthomas avatar jobypthomas commented on June 25, 2024

@iyashiyas @ferns-it can you share your AndroidManifest and a more detailed code snippet? Specifically have you used permission_handler package?

from esc_pos_bluetooth.

jobypthomas avatar jobypthomas commented on June 25, 2024

@iyashiyas @ferns-it I was able to figure out. Thank you. However, it does not work with Android 12. Worked fine with Android 9.

from esc_pos_bluetooth.

ozhankucuk avatar ozhankucuk commented on June 25, 2024

Thanks ,this works for me
I migrated my project to null safety.
targeting sdk 30 to 31

from esc_pos_bluetooth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.