Detecting Proximity of Paired Bluetooth LE devices (i.e. iPhone, Apple Watch) from Mac - objective-c

From macOS, I'd like to detect the presence/proximity of already paired (via iCloud) Bluetooth LE devices such as a user's iPhone or Apple Watch. Is there a way to do this without running a custom-built app on the user's iPhone/Watch?
I can easily get a list of devices using CoreBluetooth, and seemingly also get RSSI signal strength from this device list, but I don't see a way to correlate the random UUID with a known device, as described in this question.
I've looked at some possible solutions including turning an iPhone into an iBeacon and the MultipeerConnectivity framework, but it looks like both of these require an app to be running on all devices (Mac, iPhone, and Watch). An example app that does not appear to require an app running on the iPhone/Watch is here.
Please note that I am working within a sandboxed environment. Thank you in advance for any suggestions.

Related

Why is Bluetooth Low Energy not connecting on some devices?

I'm quite new to Objective-C programming and I have a problem with my app.
It connects to a device (an electronic board) through a Bluetooth Low Energy interface. My iPad is acting as a Central Manager, and the device it gets the data from acts as a Peripheral.
I use the CoreBluetooth framework.
It connects perfectly when I run the app on my iPad (iOS 7.02), but on any other device it hardly ever succeeds. I tried it in four other devices, all of them with the same iOS (7.02) and they hardly ever connect successfully to the electronic board (they managed to connect in a couple of chances).
I'm lost and don't know where to open a path to find the solution to that problem.
I don't know which other information could be useful to solve that problem.
Well there is the obvious, but worth mentioning. You bluetooth is on and you've scanned and picked up the Smart Device with your Smart Ready device. Given a yes to all of the above it just won't connect?
Have you ensured that it's not auto connecting to one of your other devices that you've previously connected with? Unless you've made some extraneous adjustments to your smart device's firmware it will only connect to one device at a time.

Is there something that iBeacon offers that can't be done on iOS 6 using Core Bluetooth?

I've been starting to read about the above and on BLE devices in general and trying to find the differences between those 2 frameworks. Is there something that the iBeacon API offers beside the option to use startMonitoringForRegion with CLBeaconRegion (which will basically "wake up" or notify the app that you're in range)?
To my understanding on iPhone 4S and up I can get a list of BLE devices and check their signal strength on iOS 6 sure, i't will not be as simple as the API for ranging but still, am I missing something?
Thanks
Yes, the CoreLocation APIs allow you to see iBeacon devices where CoreBluetooth does not. See my in depth discussion of this here: http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
This may not matter if you want to roll your own Bluetooth LE devices that are fully visible by CoreBluetooth. But such devices are somewhat more complex and more power-hungry. iBeacons by contrast are transmit only and send a minimal amount of data.
The bottom line is that if you want your app to see standard iBeacons, CoreBluetooth simply will not do the job.

How to catch bluetooth peripheral's command

I want to catch commands from bluetooth peripheral in iOS.
Could anyone help me out?
There are a few ways of doing Bluetooth on iOS, and different ones have different methods:
An accessory that's part of the Made for iPhone program (see the answer to this question if you want to know what that entails)
A device that uses Bluetooth 4.0 Low Energy mode
Talking to another iPhone with GameKit
A device using one of the Bluetooth profiles Apple support natively: Hands-free profile, headset profile, A2DP, AVRCP, etc.
To answer those in order:
If you're part of the Made for iPhone program, you'll already know where to find this information, and it's not public: ask your contact at Apple for help.
If your device uses Bluetooth 4.0 Low Energy, look into the Core Bluetooth framework.
If you're trying to get two iPhones talking together, look into GameKit.
If you're working with a device that uses an Apple provided profile, you shouldn't have to do anything, it'll just work. For example, an A2DP device will stream audio played from the phone without needing programmer intervention. You can do a few things to control it: there's a Core Audio function somewhere that lets you choose whether to send audio to a Bluetooth device. If you're trying to support AVRCP, look into handling remote control events.
If your device doesn't fall into any of the above categories, you're probably out of luck and can't use it with iOS.

Optimizing website for mobile devices

I am developing a website exclusively for mobile browsers.
What guidelines should I follow to optimize the site for mobile development?
My main concerns:
Most mobile devices have propriety browsers. How can the app be tested on those different browsers (testing on an actual device is not possible due to security restrictions)?
How to optimize the site for different screen sizes?
How to make the app touch friendly?
How to detect orientation of devices (in devices that come with an accelerometer)?
How to check that the device is not a desktop/laptop?
Things that I have used when designing mobile websites.
Find out the range of devices that you are planning to support. Some questions that you can ask are
Are u going to support only smartphones
What platforms are u planning to support ( iPhone, Android, Symbian ? )
A lot of you questions can be answered by the kind of Analytics that you are able to gather. If you have very less statistics then you can follow this strategy to start with.
Separate out the target range of devices into
simple ( basic phones with minimum browsing capabilities. ) - Design a very simple plain vanilla site for them.
medium ( older generation smartphones with browsers with poor javascript support ) - Design a site that has slightly better features.
Highend smartphones ( iPhone, Android, WebOS ) - Provide jazzy features that these phones support.
Use a device detection library like WURFL / .Mobi for device detection and WALL for dynamic rendering of content.
You can use .Mobi to detect an HTML5 compliant mobile browser. That way, you can take advantage of HTML5 capabilities in the devices that support it.
For testing you can follow this approach
test on browsers - Firefox / Safari / Opera have plugins to alter USER_AGENT and can simulate mobile testing.
Test on simulators - All the device platforms provide free to download emulators
If needed try device emulation products like device anywhere / perfecto.
I hope I was able to clarify atleast some of you questions. :)
The definitive guide has to be the W3C Mobile Web Best Practices: http://www.w3.org/TR/mobile-bp/ Don't let the length of it put you off - I find it much easier to read than other W3C specs. The key section is the Best Practice Statements, divided into bite-size chunks, often with an example. There's also a recent and extensive mobile web optimization guide here: http://dev.opera.com/articles/view/the-mobile-web-optimization-guide/ (disclaimer: I work for Opera)
Q1 Most mobile devices have propriety browsers. How can the app be tested on those different browsers (testing on an actual device is not possible due to security restrictions)?
The answer depends on how many devices you want to test and support.
iPhone: device and simulator are available.
Android: devices and emulator are available
Other mobile phones?
check http://www.deviceanywhere.com
Of course, you need to pay service fee. But i think its reasonable.
Q2 How to optimize the site for different screen sizes?
iphone4
WVGA854
WVGA800
VGA
HVGA
QVGA
QCIF+
Making contents for all different size is difficult. So have to make a choice about screen size and supported models.
Q3 How to make the app touch friendly?
It is your design issue.
Q4 How to detect orientation of devices (in devices that come with an accelerometer)?
Android and iOS has special message about such event. You have to follow such message.
Of course, you need both landscape and portlait layout.
Q5 How to check that the device is not a desktop/laptop?
You can use User-Agent header or IP address. But IP address is not good method.

Mac OS X bluetooth programming sample?

I am trying to develop an application using bluetooth in my Mac mini. However, after searching all over net, all that I could find was the "Bluetooth Device Access Guide" from Apple, and not a single sample program!
Can anyone suggest of any sample code for this available ?
what I am trying to do in my program:
I want to pair my iPhone with my Mac programmatically over the PAN profile, and then send data (streams) both ways. I paired them manually, and I was successfully able to transfer data. I just want to do that programmatically!
[In 2016] I suspect you want CoreBluetooth
The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with devices that are equipped with Bluetooth low energy wireless technology
You can do things like discover paired devices around you, read and write, and it documents best practices!