Giter Site home page Giter Site logo

Comments (4)

smsissuechecker avatar smsissuechecker commented on June 3, 2024

Hi @mthnzbk,

I'm the friendly issue checker.
It seems like (50.00 %) you haven't used our issue template 😢 I think it is very frustrating for the repository owners, if you ignore them.

If you think it's fine to make an exception, just ignore this message.
But if you think it was a mistake to delete the template, please close the issue and create a new one.

Thanks!

from dotnet-bluetooth-le.

janusw avatar janusw commented on June 3, 2024

I don't get any error in the code below, but the StartScanningForDevicesAsync() method does not find open bluetooth devices. So Adapter.DeviceDiscovered += async (s, a) => {} I don't get any output in this part. Nor error.

Possibly you're failing to request permissions properly? See https://github.com/dotnet-bluetooth-le/dotnet-bluetooth-le#permissions

You need to add the relevant permissions to your manifest and also request them at runtime.

Which SDK level are you targeting? Do you use Xamarin or MAUI?

from dotnet-bluetooth-le.

mthnzbk avatar mthnzbk commented on June 3, 2024

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <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_ADVERTISE" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.READ_USER_DICTIONARY" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" /> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="33" />

`protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.BluetoothScan) != Permission.Granted)
{
ActivityCompat.RequestPermissions(this, new[] {Manifest.Permission.BluetoothScan }, 0);
}

if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.BluetoothAdvertise) != Permission.Granted)
{
    ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.BluetoothAdvertise }, 0);
}
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.BluetoothConnect) != Permission.Granted)
{
    ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.BluetoothConnect }, 0);
}
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.BluetoothAdmin) != Permission.Granted)
{
    ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.BluetoothAdmin }, 0);
}

}`

.net 7 Maui

from dotnet-bluetooth-le.

janusw avatar janusw commented on June 3, 2024

From https://developer.android.com/develop/connectivity/bluetooth/bt-permissions:

If your app uses Bluetooth scan results to derive physical location, declare the ACCESS_FINE_LOCATION permission. Otherwise, you can strongly assert that your app doesn't derive physical location.

from dotnet-bluetooth-le.

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.