Core Bluetooth

RSS for tag

Communicate with Bluetooth 4.0 low energy devices using Core Bluetooth.

Posts under Core Bluetooth tag

176 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Unable to detect Bluetooth devices in the background on iOS 16.6.
Bluetooth devices could not be detected in the background on iOS 16.6. Up until iOS16.0.3, the same code was able to detect Bluetooth devices. Did the update between iOS 16.0.3 and iOS 16.6 put restrictions on Bluetooth scanning? It is initiating a Bluetooh scan upon beacon detection. The beacon is detectable. Below is the code. func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) { switch (state) { case .inside: print("StartBeaconNavigation: iBeacon inside") myLocationManager.requestAlwaysAuthorization() if(bleManager.linkState == .disconnected) { _=bleManager.startScan() } break; case .outside: print("StartBeaconNavigation: iBeacon outside") break; case .unknown: print("StartBeaconNavigation: iBeacon unknown") break; } } func startScan() -> Bool { print("BTMana:startScan") if( centralManager.state == .poweredOn ) { if centralManager.isScanning == false { let UUIDs: [CBUUID] = [systemServiceUUID] let scanOptions = [CBCentralManagerScanOptionAllowDuplicatesKey: true] centralManager.scanForPeripherals(withServices: UUIDs, options: scanOptions) return true } else { print("BTMana:startScan NG for scanning...") return false } } else { print("BTMana:startScan NG for state is not powerdOn ") return false } } As above, we are specifying the UUID of the service when scanning. Thank you in advance.
3
0
795
Sep ’23
Sometimes I cannot scan for Beacon or BLE in the background on iPhone
Hello. I am trying to create an app that detects the beacon and makes a BLE connection when the beacon is turned on while the iPhone is in sleep mode, without the app being on the app switcher. However, there are often times when beacons cannot be detected or BLE connections cannot be made. From what I've found, it's because iOS limits beacon/BLE scanning for security reasons. I know it's impossible, but is there any way to remove this restriction on scanning? If you can't, we would like to know when iOS places restrictions on scanning. If you can't, then we would like to know when iOS places restrictions on scanning and when those restrictions are lifted. Thank you very much. Development Environment: iPhone8 (iOS 13.7), iPhone13(iOS 16.0.3), macOS Monterey, MacBook Pro 2020(Intel Core i5), Xcode 14.2
1
0
474
Aug ’23
Background mode for BLE app
Hi. I have medical app that communicates with bluetooth device all the time monitoring heart rate and oxygen. I set it as background: External accessory communication, Uses BLE, Background fetch, Remote notifications, Background processing. Unfortunately after about an hour max 2 hours it stops communicating with bluetooth device and stops sending data to the server. I know in Android for example if device in similar to iOS background mode but phone plugged into power then app will never be suspended. Is there some way for the app to be always running? We can tell users to keep it powered or always in foreground. Please help.
2
0
695
Aug ’23
centralManagerDidUpdateState is not called after user selection in Bluetooth permissions dialog
Hi, team. We are implementing a process to obtain Bluetooth usage permissions in order to use Bluetooth by iPhone, and we are having some unexpected behavior in the process, so we need someone's help. The problematic behavior is that the centralManagerDidUpdateState is not called after the user makes a selection in the Bluetooth authorization dialog. Expected behavior Instantiation of CBCentralManager Bluetooth authorization dialog appears on the screen Select "Allow" in the permission dialog After selection, centralManagerDidUpdateState is called CBManager.authorization becomes .allowedAlways Problem behavior Instantiation of CBCentralManager Bluetooth authorization dialog appears on screen centralManagerDidUpdateState is called before selection Select "Allow" in the authorization dialog After selection, centralManagerDidUpdateState is not called What could cause the centralManagerDidUpdateState to be called at such a time as the problematic behavior? Supplementary explanation CBCentralManager is held as a property and the instance is not released when the dialog is selected in the problem behavior. CBManagerState of CBCentralManager is .poweredOn and CBManager.authorization is .notDetermined in centralManagerDidUpdateState during problem behavior.
0
0
429
Aug ’23
How to start a hands-free Nearby Interaction (UWB) session using Bluetooth?
Hello, Our team is working on a mobile app that uses Nearby Interaction framework (UWB technology) to get real-time high-accuracy ranging information with our third-party UWB-enabled device. So far everything works fine, background sessions included as explained in wwdc2022/10008 video. We are using Bluetooth LE to exchange the UWB parameters as recommended by Apple. Our next goal is to go for a full hands-free configuration of the UWB session. Let's think of an access control use case where UWB is used to measure the distance between the user and the door (credentials exchanged via Bluetooth). What we want to achieve is to start the UWB session without requiring the user to take the phone out of his wallet and open the access control app. What it works for us today is if the user starts the app, then switches off the screen and puts the phone into his pocket. The app is still running in background, so the Bluetooth Scan keeps working, the Bluetooth session starts, the UWB parameters exchanged and the UWB session started in the background, all good. But what if the user killed the app or never started it after reboot? How can we force the app to start from killed state when the BLE / UWB third-party accessory comes into proximity? iBeacon seems like a promising approach, but according to the forums, in iOS 16 the app will not be restarted from killed state. Is this correct? Any idea / suggestion about how to let the OS start our app when the user approaches the BLE / UWB accessory and the app is in killed state? Thanks in advance for your time. Regards.
2
0
929
Mar ’24
what is the market share of Bluetooth Classic iPhones in 2023 now ?
i have been making ios app that communicate with ESP32 using bluetooth classic. but this is very difficult to develop, because i can't find any Bluetooth scan app for test that can communicate with ESP32 until now, moreover, i can't find any sample code for Bluetooth Classic Communication . my client want me to make ios app using Bluetooth classic because of compatiblity, in other words, still, users using Bluetooth Classic iphone are used lots of users more than Bluetooth Low energy. so i doubt this assumption is right. if i make a bluetooth low energy app, can it be a trouble ?
1
0
546
Jul ’23
How to connect to a peripheral already paired with iphone without scan again.
I working with an app have ability to connect to an peripheral device. When the device paired, it's stop broadcasting so I can not found it again by scanForPeripherals until I go to setting on iphone and forgot that devices. This is so inconvenient to user. When they kill app, the connect is break and when they open app again, they can not connect to my peripheral device. I already try use retrieveConnectedPeripherals and retrievePeripherals to get the peripheral back to connect but both thing seem to be notworking. Both method not return anything and Idk why. Does anyone have same use case and know how fix this ? Thanks so much!
1
0
495
Jul ’23
how can i use this "https://developer.apple.com/documentation/corebluetooth/using_core_bluetooth_classic" sample code ?
i want to make a bluetooth classic code i found sample code at apple web site just like below https://developer.apple.com/documentation/corebluetooth/using_core_bluetooth_classic but i can't use... i need some explanation for this, i watched video below https://developer.apple.com/videos/play/wwdc2019/901 but i need more easy and detailed explanation. this is all~~~ about ios bluetooth classic explanation in text. please help me is any other clips in youtube or sites that explain this easy and in detail ?
0
0
390
Jul ’23
how can i make a ios bluetooth classic program? is this Mission Impossible?
i must make a code that ios app communicate with esp32 module over bluetooth classic . i have been searching for several weeks... but i didn't find out sample code for bluetooth classic. i found one code that use External Accessory Framework. but this needs a registration for that device some one says that i can't this. because ESP32 Module can't be registered . and i found another one it is coded by reactive native. but finally, this one use a MFi(Made For Iphone) that use External Accessory Framework. i guess.. is it impossilbe that making a ios app that communicate with other device over bluetooth classic ? so, now i am finding some apps that can communicate esp32 module that is coded by arduino IDE over bluetooth classic, and this arduino app can communicate with android bluetooth classic terminal app. please help me
9
0
2.2k
Sep ’23
Arduino HM-10 Bluetooth with iOS : Connected, but it doesn't send values
I'm trying to make an iOS (SwiftUI based) app to connect the arduino and send the current latitude value of ios to arduino. I successfully made the view that allow user to select the bluetooth device, and the UUID/name of the device is successfully displayed. Also, the arduino device detects connection (I used LiquidCrystal to display serial and it says "OK+CONN" and "OK+LOST" if connection was lost.), but when I click "fetch location" button, nothing happens on arduino side. The code is in stackoverflow due to character limits: https://stackoverflow.com/questions/76752529/arduino-hm-10-bluetooth-with-ios-connected-but-it-doesnt-send-values
0
0
612
Jul ’23
hello, i am finding Swift Bluetooth Classic communication sample code.
i am coding swift Bluetooth classic Communication program. my app need to communicate with esp32 with Bluetooth classic. but i didn't know how i can do this. there are so many sample code that use Bluetooth Low Energy communication with Swift or SwiftUI but i can't find Bluetooth classic with swift or swiftui. i think apple doesn't support Bluetooth Classic Communication . for example, they doesn't explain well about "Using core bluetooth classic" guide at their document at apple web site.
0
0
436
Jul ’23
Bluetooth Connection Interval (iOS 16+)
My company has a Bluetooth 4.2 hardware product that requires a connection interval of 15ms to operate correctly. Starting with the release of iOS 16, we noticed these connection parameters are being rejected and we are provided a connection interval of 30ms which leads to severe packet loss. I'm aware of the note on page 193 of this document that specifies this may happen on some devices, but it had not been an issue up until the release of iOS 16. Does anyone know the precise circumstances that would lead to the scaling of this interval? Is there anything that can be done in software or firmware to get around the issue?
1
0
963
Jul ’23
Can an iOS Device Act as a Bluetooth Keyboard/Joystick Peripheral?
I am trying to turn an iOS device into a Bluetooth keyboard/joystick peripheral. I know iOS 16 supports the HID profile for communication with Bluetooth keyboards and game controllers (https://support.apple.com/en-us/HT204387). However, is it also possible for an iOS device to act as a HID device, advertising services like the HID? I've seen an app, BlueTouch seems to make the similar functionality, and sample code on Github (https://gist.github.com/conath/c606d95d58bbcb50e9715864eeeecf07) suggest this might be possible. Has there been any change in iOS that would allow an iOS device to act as a Bluetooth HID device? Could you point me to the relevant documentation or sample code? Thanks for any guidance you can provide.
0
0
544
Jul ’23
How do I use bluetooth to send only a value of 0 and up to a bluetooth device?
How do I use Core Bluetooth in the simplest possible way to send a value of 0 to 1 from an iOS device to a bluetooth peripheral that does nothing but interpret the value sent to it as how strongly a vibrating component on the bluetooth peripheral should vibrate. A value of zero would mean the peripheral device doesn't vibrate at all, of course. The bluetooth peripheral would be the bluetooth ***** of course, and the iOS device would be the bluetooth master. The ***** device doesn't need to send anything at all to the master iOS device, except to link to the master. I don't know if that would allow the ***** bluetooth device to be any less expensive or smaller or simpler.
0
0
488
Jul ’23
Xcode IOS Error Keeps Popping Up On Specific Page
Hi There, I am currently coding an app which uses the CoreBluetooth Function to scan for nearby peripherals. I keep finding myself an error when I specifically click on my Bluetooth page. The error I am met with is: "Thread 1: "String does not represent a valid UUID"". I have tried my luck with fixing this error but can't see to find the root of the problem. Help would kindly be appreciated In finding how to fix this. Cheers, hupfawil2023
1
0
428
Jul ’23
"Encryption is insufficient" message with BLE
I'm working on a BLE app with a hardware partner using samples of their device, which I am able to erase and re-flash when needed. When I try to use the device it initially works fine. I can connect to it, make requests, and get back responses. However, after a short time and a few successful runs, I start getting the error "Encryption is insufficient". The error is seen in the "didUpdateValueFor" function. I can still connect to the device, and enumerate all of its services and characteristics, but I can't read any data. If at this point I re-flash the device and also go into the iOS setting app and "forget" it, then I can use the device normally again, at least for a while. What causes this? Is there a way I can fix it in my app? Thanks, Frank
3
0
1.2k
Aug ’23