I tried B4XPages, but now I get a PROBLEM WITH PERMISSIONS:
Î got this error:
[TABLE]
[TR]
[TD]'*** Service (Starter) Create ***
'** Service (Starter) Start **
'** Activity (Main) Create, isFirst = True **
'puls init
'Call B4XPages.GetManager.LogEvents = True To enable logging B4XPages events.
'** Activity (Main) Resume **
'puls status
'StateChanged: 12
'puls scan
'Error occurred on line: 26 (HeartRateMonitor)
'java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission For AttributionSource { uid = 10359, packageName = b4a.example, attributionTag = Null, token = android.os.BinderProxy@d19f2b3, Next = Null }: GattService registerScanner
' at com.android.bluetooth.Utils.checkPermissionForDataDelivery(Utils.java:901)
' at com.android.bluetooth.Utils.checkScanPermissionForDataDelivery(Utils.java:960)
' at com.android.bluetooth.gatt.GattService.registerScanner(GattService.java:3677)
' at com.android.bluetooth.gatt.GattService$BluetoothGattBinder.registerScanner(GattService.java:945)
' at com.android.bluetooth.gatt.GattService$BluetoothGattBinder.registerScanner(GattService.java:933)
' at android.bluetooth.IBluetoothGatt$Stub.onTransact(IBluetoothGatt.java:293)
' at android.os.Binder.execTransactInternal(Binder.java:1316)
' at android.os.Binder.execTransact(Binder.java:1280)
[/TD]
[/TR]
[/TABLE]
|
I added this to the Manifest
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.BLUETOOTH_ADVERTISE)
AddPermission(android.permission.BLUETOOTH_CONNECT)
AddPermission(android.permission.BLUETOOTH_SCAN)
Still the same
I know code like this
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_CAMERA)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Log(Permission & " : " & Result)
|
but the values for Bluetooth are not constants of RuntimePermissions.
I have attached the little project.
@Erel: You say "If you are not using B4XPages then you are doing it wrong."
I do not see this warning when I create a new project, choosing "standard" or when I am using your class. Why? Why even allow to use (old or new) standard projects when it is wrong - without any error message?