CoreBluetooth or the EAAccessoryManager and hands free - objective-c

Is it possible to know if an iPhone is paired with the hands free system in a car using the CoreBluetooth or the EAAccessoryManager? If not, is there another way to do it?

If the iPhone considers the car an accessory you can get the connected accessories by calling:
[[EAAccessoryManager sharedAccessoryManager] connectedAccessories];
This will return an array of EAAccessory objects which you can then query to get certain information like the name: accessory.name.
I don't know for certain of this will work with cars having never tried it myself (I have used it with other accessories), so I would suggest that you create a test app that logs the connected accessories to the screen on demand and test it yourself.
Here's the documentation for EAAccessoryManager and EAAccessory.

Related

iOS - Record the Voice while phone call in Objective c

Is it possible for an app which records the voice of the user while a phone call?
I searched for it and the AVFoundation Framework seems to stop recording when a phone call is incoming. I don't want to record the whole call, I am just interested in record what the user of the iPhone is saying.
I know that this possibility might be a safety risk, but it would be nice for e.g an interview.
In case of no possibility to do it like i want, i have to create my own VoIP connection and then i can record it, am i right?
There is no direct way or API from Apple to achieve your need of recording voice while phone call. AVAudioRecorder wont support it as well. Because it will be stopped once the call begin.
But there are work around like hook AudioUnitProcess in order to access phone call's audio streams and save it as m4a. This will work without jailbreak but not sure this will be accepted by Apple app store review team.
For more info on the work around check this SO accepted answer.
Also creating your own VoIP connection method work for recording during phone call.
There are Cydia tweaks which are able to do that. For example CallRecorder.

Is it possible to Access all Beacons with ibeacon API?

i'm close to finish an App using Estimote beacons having their UUID
hardcoded in my project which list out all the Estimote beacons using ibeacon API, but when i'm trying to make my own device as a beacon transmitter using the Device UUID, which is differ from the estimote UUID, i cannot find it, as the UUID which i mentioned in the code is Estimote's.
So my question is , is there any way that i can find all the beacons(Ex- Estimote Beacons, Kontakt Beacons, Blue cat Beacons and ibeacon hardware) which i can track with apple's ibeacon API?
With same code i wanted to track all beacons without hardcoding any UUID?
is it possible?
No,Apple has put restriction on finding of unknown Ibeacon .You can not find any unknown beacon.Though there are some hacks which are not that effective.Also there can not be more than one Udid a app region can contain.What you can do either is that ask the user what Udid he wants to monitor then the app can range for it.
Sorry for wrong spelling if any..
No, you must tell CoreLocation the ProximityUUID of any iBeacon you want your app to see or it will not tell you about it. See http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
This does not mean you need to hardcode every UUID in your app. Doing so would require you to resubmit the app for approval each time you add an iBeacon with another UUID.
An alternative is to use a web service to give you a list of UUIDs to search for. You can build your own, or use my company's ProximityKit service that does this for you.
I wrote a test bench app for my company that has an array of UUIDs. It saves a default set of UUIDs to user defaults using the registerDefaults call.
The user can then create new UUIDs at will, as well as sharing them with other devices. (I Use a UIActivity, so you can share via AirDrop, messages, email, etc.)
It lets you input a UUID as hex digits, or you can tap a "create new UUID" button to generate a new UUID.
I included the Estimote UUID as well as the 3 UUIDs Apple includes, and a couple of unique ones.
Our test bench app then uses the list of UUIDs for both transmitting and receiving beacon IDs.
So while the UUIDs are stored locally, they are not hard-coded.
You could certainly also fetch a list of UUIDs from a web service as David proposes, or use iCloud to fetch a user-defined list of IDs across all devices that use the same AppleID.
A bitter truth for those who want to discover arbitrary iBeacons and their uuids.
There doesn't seem to be any hack to look for an arbitrary iBeacon on iOS -- you have to know at least the ProximityUUID to see one.
Using CoreBluetooth is pretty useless for working with iBeacons. You can see their advertisements, and measure the signal strength, but you can't see any of the identifiers, and thus, you don't even know for sure if any advertisement you see is an iBeacon at all, versus any other BluetoothLE device.

iBeacon in the background - Use cases

The number of questions on SO related to iBeacon and its background capabilities is increasing and there is some confusion on that point.
I have been testing the AirLocate project.
iBeacon has 2 "capabilities": Region monitoring and Ranging.
Region monitoring is limited to 20 regions and can function in the background (of the listening device) and has different delegates to notify listening app (and user) of entry/exit in the region - even if app is in the background or phone is locked.
Ranging works only in the foreground but will return (to the listening device) an array (unlimited?) of all iBeacons found along with their properties (UUID, etc..)
In addition, that 20 regions monitoring is a device limit. If the user is using geofencing reminders, other apps that use region monitoring; this will lower that number.
So are we saying that I can not deploy a mall-wide (100 stores+) app that uses store iBeacons to send a "store specific" notification to the user, while the app is in the background or the phone is locked?
I gather that the advertising device (the beacon) has to be in the foreground as well to advertise a region that the listening device could "enter" into. So are we saying, that if the owner of a store had an iOS device; I could not for example save him money by asking him to use his iPhone (at least early on) as an advertising device (beacon) - since the app will likely not always be in the foreground?
So in the case of iBeacon + MLB, a single UUID (or <20 UUIDs) is/are used for the app to possibly determine entry door and, then will the user be required to unlock the phone/bring the app to the foreground to use it (find seat, etc..)?
Can I then call the iBeacon: a single location/event (store, park, etc..) feature that requires the user's most "foreground" attention to have a "complete" practical use case?
I have tried to be articulate about the user cases to bring it to practical. Please reply with more than yes or no.
Sounds like you are on the right track. In general you are correct that an app needs to be in the foreground to fully use iBeacon capabilities. A few specifics on your three main questions:
Your mall use case can work with a couple of limitations. (a) you have to conserve your CLBeaconRegions by having many or all 100 stores share the same UUID and/or major number, differing only in the minor number. This allows you to set up a single CLBeaconRegion to monitor many. (b) If the app wakes up into the background from seeing iBeacon 1, it won't be able to wake up a second time from seeing iBeacon 2 in the same CLBeaconRegion unless it first stops seeing any other beacon in that CLBeaconRegion. (You can game this a bit by setting up several CLBeaconRegions and trying group stores so adjacent ones in the overlapping 50 meter bluetooth radio range are in different CLBeaconRegions.)
No, a store owner cannot use their iPad act as an iBeacon in the background -- it has to be in the foreground to work. But they can have their Windows or Mac computer do this using a virtual iBeacon program. My company offers one for free download: http://developer.radiusnetworks.com/ibeacon/
In the door entry use case, yes, the user would have to acknowledge the notification on the lock screen to bring the app into the foreground. A typical implementation would use a single CLBeaconRegion (probably with all iBeacons sharing a ProximityUUID and maybe even a major) to alert the user.
Edit 4/11/2020: Apple announced plans for a new beacon advertisement that will work in the background. See here for more info.

Turn iPhone into a server programmatically?

I want to make my iPhone app display on a Mac's screen, kind of like AirPlay does with other machines. The only way I have heard to do this is, although I do not like it, turn the iPhone into a server. Unfortunately, I cannot figure out how to do so. I also wanted to set it up in such a way that my Mac automatically detects it. I have seen a similar setup in the game Chopper 2. My Mac app will have a simple timer that fires every few seconds to look for the iPhone, in the same way that Chopper 2's "Find iPhone" button does.
Is there a simple way to turn the iPhone into a server, or start a "session" like Game Center does?
One last thing: I know it is somehow possible, because another app I have actually gives my iPhone a web address at the click of a button. It is called the Dicenomicon, if you want proof.
First there is no easy way to redirect your display to Mac, even if you made it a server of some kind.
Second, to discover or publish customized services on WLAN, you may want to refer to the samples on Bonjour:
CocoaHTTPServer: a simple TCP/HTTP server.
WiTap: an app that discovers and connects to services of the same kind on WLAN by Bonjour.
I'm not really sure what you mean by "server", because there is no way to share the screen of an iPhone using the official SDK, although this is possible by jailbreaking.
It would be possible, however, to send data back and forth between the Mac and iPhone, and display the data on the iPhone, on a Mac. Using that data, you could try to recreate the interface on the Mac. All of this could be accomplished using sockets. A class that might help with that would be cocoaAsyncSocket, which makes network programming a lot easier.
The auto-discovery of iPhones on the local network is achievable with Bonjour. Without getting into too many details, NSNetService would allow you to publish a service for your app from an iPhone, and NSNetServiceBrowser would allow you to find that service on the local network from the Mac. From the NSNetServiceBrowser, you could establish a socket connection with the iPhone.
Good luck!
You might want to take a look at the GameKit APIs, I know they do something similar between two iOS devices.
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html

What is the best way to start a movie the first time your app starts

I want to have a movie start the first time my app is launched to train users on its use, say a 50 second clip.
How would I go about doing this in an iPad app?
(I am building a very complex platform that has hooks into the web and need users to be aware of that. The video will explain that users can go to the website for different features. When the app starts for the FIRST TIME only I want the video to play.)
Don't force users to sit thru a 50 second movie when the app starts. Your user interface should be obvious enough that they can figure out the basics without watching a training video. If you want to offer it, provide a help button, where they can watch it when they choose to.
See the iPhone HIG section Minimal User Help, which says:
A hallmark of the design of iPhone
OS–based devices is ease of use, so
it’s crucial that you meet users’
expectations and make the use of your
application immediately obvious.
EDIT -- The simplest way to keep track would be to store a flag indicating whether or not you have shown the video by using NSUserDefaults. Check if it's set at startup, set it after showing the video the first time.