How does apple store app knows my in-store location? - ios

I notice when I walk into local Apple Store (the real shop), the Apple Store app on my iPhone 5s will show a welcome from the exact store (e.g. Apple Store XX where XX is a store name). I assume this app recognizes my location somehow. This store (in China) is not equipped with iBeacon yet, and after turning off BlueTooth I can still see the greetings. I continued to shut down WiFi, and restarted this app, then location and greeting is gone. Note I didn't connect to the "Apple Store" WiFi hotspot for all tests, but it definitely indicates the WiFi is relevant with the location mechanism.
So my question is:
how can this app know I'm near to or within the physical store based on WiFi scanning?
Is it part of Core Location public API? (if yes, I should be able to do the same thing for any shop with a WiFi signal - please explain how to achieve this in details if you know).
Or instead, is Apple doing their own dirty job but rejecting others all over the world to do the same? By dirty job, I mean a mapping from SSID to the exact location while device is not connected to the WiFi.
Thanks, geeks.

Related

How do wifi bulbs pair with the mobile

I have been working on making a commercial-equivalent smart WiFi bulb. I cannot understand how the bulb pairs with the app on smartphone and gains access to the Internet through my personal modem. The bulb cannot communicate through the personal WiFi before getting paired, as it doesn't have the credentials. I tried to experiment with my existing commercial bulb and while putting it in reset mode, noticed -
There wasn't any WiFi (that could be the bulb's AP) visible in the available networks list of my PC. Well, I don't know if it was a hidden network.
There wasn't any Bluetooth device visible in the list that could possibly be the bulb.
So I want to know how the bulb communicates with the app -
Does it act as AP (Access Point) and the app connects to it and gives it the credentials.
Else, does the bulb use any other type of communication to pair with the app.
Or, does it somehow just get to the smartphone and it all "mysteriously" works.
I would be happy if someone could explain the process to me. Also, the app scans for the available devices whenever I want to pair to a new device. Then, I can select the desired device and pair it. So, please also explain (if possible) how the scanning works.
No need to get to each technical detail, I just want to know the process. I will ask later if I need the tech details.

ESP32 iPhone Bluetooth, just a general question

I'm writing some code (C++) for ESP32, to act as a BLE beacon. The problem is this: the iPhone doesn't send out its real MAC address, but does a random-generated MAC address, for security. The thing I'm confused about is how do you know if it's a device you've previously paired with?
So let's say I detect a new BLE MAC address, and looking at the manufacturer data I can determine it's an Apple device (first 2 bytes are "4C").
Now I need to know if I've previously paired with that device, so that I can allow the ESP32 to initiate an action (for simplicity let's just say turn on an LED). If that MAC address is in a list of known devices, then I can continue, and if not, I ignore it.
The problem is, if the iPhone is not giving up the real MAC address, the detected MAC address will never match anything. As this is a security situation I'm sure the algorithm for generating those MAC addresses is not known.
To be clear: this code is being written for the ESP32, not the iPhone.
It is in fact not possible to tell if a device has been previously seen, unless you pair and establish a bond with it. Once you pair with the device, long-term keys are exchanged and are used to quickly re-establish the connection.
This is by design. MAC addresses were originally unique, but this allowed tracking people and devices without their consent. You can read more about this in the following ESP-IDF guides:
GATT security server walkthrough
GATT security client walkthrough
So are you using esp32 as a beacon? This dose not involve any pairing or iOS MAC addresses. iOS will just be able to listen and the esp32 will not even know someone is "listening" to its broadcast.
Probably iOS application can store which services it is interested to hear to; may looks like pairing.. but it is a high level application managed technique and not any related to what BT standard calls pairing.

Is it possible to track the data collected by iPhone apps in your device with relevant server names they are sent to?

I want to develop an iPhone application which can track the contents (such as location information, device hardware/sw information, contacts …etc) being collected from your device by all the applications and give a report to the end user at end of each week.
Because, I believe that end user should be notified about what information being collected by his device and sent to which servers to store them.
I Googled it and read few articles as well, but all pointed to the conclusion that a given application cannot (or restricted by Apple) peak into operations of other apps and collect any information about what those applications are doing.
But I've seen this Onovo Count app http://www.onavo.com/apps/iphone_count is collecting the data usage of all the other apps in your device, so can we just go few steps beyond that get this done ?
From the looks of it Onovo Count redirects all device traffic through a VPN. I presume their servers look at the host names of the traffic and record it against the device. When looking at the app, you're just looking at a dump of the data for your device.
For the rest of what you want to do, it is not possible on a standard device, you'd need to have it jail broken or something.

Check if iDevice with a specific app is nearby

Is it possible to check within an app, if there are other idevices nearby which have the app running?
For example device A starts the app. Device B also starts the app. When they are nearby, a notification will popup.
I know its possible to check the range between two GPS coordinates. But the only solution that I've found on the internet was, that I have to make a webservice/server which handles the coordinates which were sent by the idevices.
But I'd like to make it run "offline", without saving/sending the data at a webserver.
You can achieve exactly this using the new iBeacons functionality in iOS 7. I'm not sure I can link to the exact documentation due to the NDA currently (although the feature was mentioned publicly at WWDC), but if you search for 'beacons' on the Apple Developer site you should find what you need.
There are also some examples towards the end of this year's WWDC session 307 - "What's new in Core Location?". This is arguably more useful than the documentation.
Essentially, you define a beacon region and tell your devices to start advertising their presence. At the same time, you can listen out for beacons in the local area - CoreLocation will then report you the identifier and approximate distance of each device.

Can an iPhone application running in the background transfer data via USB interface?

There are 2 iPhone applications. One application running in the foreground and the other running in the background. Is there any way to get the background application to send data over USB without coming into foreground? Ideally we want to keep the foreground app in the foreground, while the background app process some data. Once the data is processed it will inform the foreground app that the data has been processed.
No it cannot. It cannot even do this without the use of private frameworks, unless you're in the Made for iPhone program. If you are, then your organization will know, based on the documentation made available to you, what you can and cannot access, when and how.
Should you be in the Made for iPhone program, and are unclear as to what you have access to and when, contact the person in your organization who is the technical contact with Apple for this program, they will be able to give you the details.
If the task is started while the app is in the foreground and you call the appropriate beginBackgroundTask/endBackgroundTask methods, you should be able to have it continue running after the app is backgrounded.
Note that access to USB is restricted (see jer's answer) and that there's no officially sanctioned way to communicate between different apps on the same device. Also, you can only buy/download one app at a time in the App Store and I can't see Apple approving an app that required you to download a second app for it to work. So you may have bigger problems to solve first.
It would help significantly if you told us what you actually wanted to achieve. For example, "I want MyApp on the user's phone to communicate with MyApp on the user's computer".
The absolute easiest way is to send data between the phone and a computer is to require that they're both on the same Wi-Fi network. Several iPhone apps incorporate a web server (this was the easiest way of "file sharing" before OS 3.2), and many more iPhone apps connect to a computer running server software.
Your other options, more or less:
Reverse-engineer the Bluetooth side of GameKit and reimplement it on the computer-side. I'm not aware of anyone who's done this. Loosely, I think it's IP over Bluetooth PAN plus some sort of Bluetooth service discovery.
Audio input/output, e.g. the headphone jack or certain pins on the dock connector. I'm not entirely sure how the mic side works (the resistance was a bit high for a carbon mic when I checked), but you might get lucky and find a way to turn it into "line in" or find "line in" pins on the dock connector.
A webcam pointing at the iDevice screen (and the iDevice camera pointing at the computer screen). Ewwwww.
Join the MFi program.

Resources