This is a simple Unity package that adds wrapper above Unity Android Bluetooth Low Energy package to read heart rate data from BLE devices.
Beware that Minify should be disabled, if enabled the Bluetooth capabilities won't work, so it should be disabled for the build. This is probably because the Unity Android Bluetooth Low Energy use prebuilt jar libraries that are not compatible with the minification process.
- Check that the custom
AndroidManifest.xmlfile is enabled in Player settings. - Check that the
AndroidManifest.xmlcorrectly configured to include the necessary permissions for Bluetooth operations. - Ensure that the Application Entry Point is set to
Activityand not theGameActivity(which is default in Unity 6+).
Example Android Manifest
You can also find the manifest in the HeartRateMonitor sample
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
</activity>
</application>
<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"/>
</manifest>
User must give permission to scan and connect to Bluetooth devices and also Location Services must be enabled on the device.