I would like to ask you just some initial directions on how to send/receive (essentially receive) some data to/from a bluetooth 2.0 device. I'm trying CoreBluetooth Framework api with no success.
At the same time, I'm sure the connection can be done due to the fact the the device is already paired within iphone 5s and it works correctly (when an incoming call arrived, by pressing the button on the device the call is opened on the iphone).
Then in particular I need to programmatically intercept (on my app) the button pressing on the device. Could you send me some helps on that?
Thank you very much.
Related
I want to write a tracking application, which reacts/record when users get in a car and phone automatically pair with Bluetooth hands free. I need also Id of the hands free device.
On Android it is easy, using Broadcast Receiver your app listen to broadcasts that device had been paired with phone. It is working even after phone had been restarted and App did not run after restart.
Is it possible on iOS(7+) ?
You can do it by reading the "Performing Long-Term Actions in the Background" part of this docs
Essentially, using state restoration, the system takes note of what your app was doing when it was killed.
If the app is searching for a bluetooth device and is killed by the system, the system will take care of continuing this research and wake up the app again when the bt device has ben found.
Note that this will work only if the app is killed by the system, not by the user (using the multitask bar). This behavior has changed since iOS 7.
Alternatively, If your BT hardware can be programmed to send advertisements using the ibeacon protocol, your app can be "awakened" by the corelocation/ibeacon api. After that prompt then maybe the corebluetooth pairing code could be initiated.
I want to know if it is possible to build this kind of bluetooth application on iOS platform.
There are two devices:
1. bluetooth device with installed camera module
- This device only has a camera module, a memory, and a bluetooth module.
2. iOS device. (sleeping - with screen black, possibly locked)
The bluetooth device can be used to do the following:
1. Press a button to take a picture
2. Send the picture via bluetooth to the Iphone,
3. Iphone wakes up, sends the picture to a server.
The key points that I'm curious about is
1. Is is possible to wake up the device with a bluetooth signal,
2. Is it possible to launch an application/wake up an application with a bluetooth signal so that it can process information/send it?
Also, if this functionality is possible, then can it be done with classic bluetooth module, without registering for the MFI program? or do I have to use BLE?
Techniques to discover the device:
1. Core Bluetooth Framework: only works for Bluetooth low energy i.e BLE.
2. EAaccessory Framework: Apple provides an API called External Accessory Framework, which can be used to interact with paired Bluetooth devices or device connected through wired, for which we have to fix the apple connector at the base of the device.
3. Gamekit Framework: if we are using game kit framework then it is necessary that the application is running in foreground in both of the device i.e if the application is in background then it is not possible to pear the device and second thing if we are using game kit framework then there is a limit of about 90k per 'send' ,so if our file is larger then 90k then we have to break it up.
If you have any queries then you can ask..
Situation: My iPhone communicates to an external device through Wi-Fi. The app has also the ability to set up a schedule. This means that on a specific time the device should turn on and do some stuff. Now for this to happen there should be a timer on the external device or the iPhone should send a command to the device on a specific time.
Question: Is it possible to send a command to the external device while the app is in the background? Or does the app have to be in the foreground? Is it possible when the external device is an accesory? Cause I have read that apps are allowed to run in the background when they need to communicate to accessories??
Thanks in advance!
No you can't do this, you are only able to run an app in the background if its stream audio, a VOIP client or track user location. If you are in the accessories program (which means you can make hardware that works with the dock connector, then your app can also run in the background. but only if the accessories that is respons to is connected.
There is no way the schedule any operation to be triggered at a set time.
You can schedule a local notification, but the user wil have to view (open you app by click in the notification) before you app get informed about it.
Do you actually have the devices communicating? If not, you should take a look at Apple's MFI (Made for iPhone) program. Sending data or communicating from your iPhone to an external accessory through bluetooth falls under it. They provide you with certain protocol specifications that allow you to communicate with external accessories. It's difficult to do something like this if you are an individual developer though. Here's the link: https://developer.apple.com/programs/mfi/.
I'm new to bluetooth. Is there a way through an API call or callback to get some event from a device that's connected via BT to the iphone? That is, without using the apple authentication chip?
A simple example would be an accessory that acts as a doorbell. My device would send "something" to the iphone to tell it someone pressed the doorbell button.
No - your accessory has to be MFi compliant
Lets consider that I am connected to internet through 3G in my App. When a wi-fi hot spot seems to be appearing, can I programmatically switch to the wi-fi. Is this vice-versa condition possible?
iOS does this automatically by itself!
If no known WiFi network is found, it uses cellular data. If it finds a known WiFi-network, it connects to and uses that network instead.
If any WiFi-network is found, and your application requests access to the internet, iOS (usually) automatically presents an alertView and lets the user log in to a WiFi-network. If the user does not log into a WiFi-network, it stays on the 3G-network. When iOS 7 comes, iOS may connect to Hotspot 2.0 networks automatically as well.
Apple keeps individual apps on a tight leash, and so they do not let apps control things like this.