Reputation: 169
I have built an app in Unity3D which should be able to detect Bluetooth Low-Energy beacons on the Microsoft HoloLens. Here is the Unity C# script code that I used to get this done.
using UnityEngine;
using Windows.Devices.Bluetooth.Advertisement;
public class BeaconDetector : MonoBehaviour
{
private BluetoothLEAdvertisementWatcher _watcher;
void Start()
{
_watcher = new BluetoothLEAdvertisementWatcher();
_watcher.Received += WatcherOnReceived;
_watcher.Start();
}
//This method should be called when a beacon is detected
void WatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
{
//Just a simple check if this method is even called
Debug.Log("Beacon detected!");
}
}
The app builds and runs on the HoloLens nicely, but (even after waiting a couple of minutes) I do not get the desired output line in my debug log. This means to me that the WatcherOnReceived()
method is never called, which ultimately means that no beacon is detected.
I use some Sensoro SmartBeacon-4AA's which can transmit both iBeacon and Eddystone signals.
I have been trying this for a couple of weeks right now, did several tutorials along the way but I still can not figure out why this is not working for me.
Upvotes: 1
Views: 3017
Reputation: 169
It was a permission problem after all. It is possible to solve this issue in both Unity (pre-build) and Visual Studio (post-build). Here are both solutions:
This will give your app the right to use Bluetooth on the HoloLens.
Upvotes: 3