List (and connect to) Bluetooth devices from within iOS App - iphone

I have a device that broadcasts data via bluetooth. It is MFI certified and I already have an application on the AppStore that communicates with it, using the External Accessory Framework.
The problem is that my application assumes the device is already paired.
Is there a way to enumerate all such devices within reach and allow the user to select (and therefore pair) to one of the devices in the list?

No, you can not do this unless two criteria are first met.
Your device must be a Bluetooth Low-Energy device.
The device must have the Bluetooth 4.0 integrated chip which, at the moment, is just the iPhone 4S and the New iPad.
These devices, if operating in the low-energy mode, can be discovered and paired through the CoreBluetooth framework. There is no walk-through form of documentation on this framework, but if you are a seasoned iOS developer, you should be able to figure out how to use the framework through the cut-and-dry framework docs.
As mentioned, information regarding the MFi program and hardware development is locked down under an Apple NDA. However, the information regarding pairing to these devices in this manner is readily available through information in Apple's own documentation.

In IOS 6.0, they introduced showBluetoothAccessoryPickerWithNameFilter:completion:
I haven't had much success with it (when it does find devices, they become lost a few seconds later, but this may be an issue with my code).

Related

iphone blutooth device connection

I have an app which has to connect to a medical bluetooth device to get data from that device. (Not to any iOS device).
Using which framework or class I can connect and receive data from?
Thanks.
After you get an MFi license, you then have to have an Apple supplied authentication chip on the bluetooth device. You must create custom protocols to transfer the data.
The BT on iOS is locked down and you can only access simple AVRCP events inside an app, no data transfer is allowed, except using GameKit (which only works between iOS devices).
UPDATE:
If you are using a BLE device then you can checkout this, it is iOS 5 only though.
http://developer.apple.com/library/ios/#documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/_index.html
Are you planning to develop this app with a jailbreak device?
If not, you have to enroll the MFI(Made For iPhone) program, then you can define your custom protocol and use the ExternalAccessory framework to communicate with your device.
If yes, take a look at Btstack project.

iPhone Bluetooth SDK - discover Android / Windows phone 7 devices and background discovery

I am an Android developer and .Net developer and not yet have acquired the needed knowledge regarding iOS .
I did a search on-line but couldnt get conclusive answers to several questions I have which are the following :
1.iOS Bluetooth , do I have to use the Bonjour or Game Kit or can I access a lower level API.
2.Do currently I have an option to perform pairing between an iPhone device and an Android device ?
3.Can an application access the iPhones MAC ID and Friendly ID Bluetooth slots and change them while its in the background ? Or while the device is sleeping ?
4.Can an application set if the iPhone is discoverable or not discoverable to other devices - not iPhone ? Can it perform it while in the background ?
Regards !
Jessy85
This might be helpful to you: How can an iPhone access another non-iPhone device over wireless or Bluetooth?
Generally, there is NO option to communicate with non-iOS device via bluetooth in regular iOS API. GameKit is intended for using between only iOS devices. However I don't know the lower level API which open to only licensed accessory hardware developer except acquiring the license is incredibly hard differently with software license.
1) You can only get to the base API if you are developing specific hardware and are a MFi member. http://developer.apple.com/programs/mfi/
2) Don't think so. But Not really sure
3) You want to change the mac id in the background? Not that I know of. Also it seems like a really questionable idea.
4) Again don't think so. Maybe with MFi but I don't know.

Can I restrict my iPhone app from being used by iPhone3G's?

My iphone app doesn't run well on the iPhone 3G. Can I make it so users with these models can't download the app? If so, what does a 3G user see when they search for my app in the app store?
Does it appear in the store at all for them? If it does, when are they notified that they can't download the app?
I recommend you use the UIRequiredDeviceCapabilities key in your info.plist. This lets you tell the App Store exactly which capabilities you require instead of which device you require.
If your app "doesn't run well" on a 3G I'll guess it is because of performance and therefore you'd want to require a newer processor. Look into setting arm7 as one of your required device capabilities.
For more info look here:
http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW3
Make it run better. Or if it's not completely unusable, just let them use it anyway. People with old devices expect them to be a bit slow.
According to the iTunes Connect Developer Guide (which links to the iOS Application Programming Guide), you can't prohibit certain devices. You can, however, require certain features which are only present on new devices:
armv7 is what I'd recommend (older devices are armv6)
magnetometer, because older devices don't have one. Apple might look at you funny if your app doesn't actually use the compass though.
opengles-2, because older devices only support 1.1. Apple might look at you funny too.
auto-focus-camera, except the iPad and all the iPod Touches don't have one. Probably not what you want.
iPhone 3GS uses iOS 6.1.x so if your app support iOS 7+ it will not be able to install on iPhone 3GS, this is the best possible way to avoid download on that device.

Two part question about submitting bluetooth-enabled apps for the iPhone

I have a couple questions about submitting blue-tooth enabled apps on the iPhone.
I want to first say that bluetooth is merely an option in the application. The application does not completely rely on bluetooth as there are many modes the user can go in.
First, do they require you to have the "peer-peer" key set in UIRequiredDeviceCapabilities even if bluetooth interface options can be disabled or hidden for non-bluetooth enabled devices? Basically, it's just an OPTION in the game and there are many other modes the player can play.. Does Apple not allow you to do that? I'm just curious, because it seems like something they would do.
Adding to that, how do you check for it's functionality at runtime? In essence, how do you check UIRequiredDeviceCapabilities at runtime. I'm aware of checking iPhone device types, so would that be a proper way of going about it?
I'm also sort of unaware which devices can run bluetooth gamekit, there doesn't seem to be a proper reference at the SDK site, or I'm unable to find it.
Thanks for reading!
[edit] I can confirm the existance of somebody rejected for submitting a bluetooth enabled app which didn't work on a iPhone 2G.. Of course, they didn't say if that was the MAIN function of the app, though.
For devices that do not support this capability, see the Game Kit Programming Guide:
Bluetooth networking is not supported
on the original iPhone or the
first-generation iPod Touch. It is
also not supported in Simulator.
If this is an optionally-enabled feature, you might be able to get by with disabling it for the appropriate devices by detecting first-generation iPhones and iPod touches using code like Jeff LaMarche's UIDevice category. If you hide this option when running on unsupported devices, if a reviewer happens to use one of those devices they won't even see that there's something nonfunctional.

Does the iPhone 3.0 SDK support serial communication?

There is already a hack to get serial communications working through the iPhone's 30-pin connector, which requires a jailbroken phone. Looking at the the iPhone development website, the 3.0 SDK seems to be a bit friendlier when it comes to communication with 3rd party hardware.
I'm not part of the developer program so can't dig into any of the technical details of the 3.0 SDK, but I'm wondering if serial support through the physical connector is going to be supported. It says Bluetooth is going to be supported, and that it's possible to go blutetooth<->serial, but I'm asking about the physical connector specificially.
What I'm considering is an iPhone app which connects to and existing device I have which speaks serial. I've never done any iPhone development or hacking.
The 3.0 SDK is still under NDA, so no registered developer is at liberty to talk about it. Just wait one more week, there's a good chance that the 3.0 SDK will go public at the WWDC keynote on June 8.
The physical and bluetooth connections are both restricted to "Made for iPod" devices. If your device is MFi then you can communicate over whatever protocol you want. If not then you are not going to be connecting without jailbreaking.