iPad: Get User Location - ios

I am working on an application that needs the location of where the user is entering information. This iOS application may run on iPhone and iPad. Given that iPhone typically come with cellular service and thus a GPS chip I don't think this will be an issue. However what about iPad? If I am developing for iPad (that will not have cellular service) how will I be able to retrieve the user's current GPS location. This would be easy to do with the CoreLocation framework if I knew I had that capability, but on iPad I can't always be certain it will be there.
How would I get around this to get the GPS coordinates, or some other way of getting the user's relative location?

Location services are available even on iPad, using WiFi.
Take a look at this Article from Apple:
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
Specifically, you can set up your app to require either location services, or to require a GPS:
Requiring the Presence of Location Services in an iOS App
If your iOS app requires location services to function properly,
include the UIRequiredDeviceCapabilities key in the app’s Info.plist
file. The App Store uses the information in this key to prevent users
from downloading apps to devices that don’t contain the listed
features.
The value for the UIRequiredDeviceCapabilities is an array of strings
indicating the features that your app requires. Two strings are
relevant to location services:
Include the location-services string if you require location
services in general.
Include the gps string if your app requires
the accuracy offered only by GPS hardware.

There are two sources in IOS devices to get user location, one is through "GPS" and the other one is "WIFI". Your must be having one of them to retrieve user's location. If your IPad is connected to a "WIFI network" even if it doesn't have a cellular connection, then it's not an issue.

Related

Does Bluetooth Low Energy devices still not show under iOS Bluetooth settings (My Devices)?

I'm trying to set up a hobby project and I'm wondering - if my device uses Bluetooth Low Energy module, will this device show under the list of Bluetooth Devices under Settings for iOS? Or will my app have to search for this device specifically before connecting? If it doesn't show in the Settings, what type of Bluetooth module would I need for that?
No, you will not see your LE devices under Settings for iOS.
See LE best practices - your app should search for the LE device.
You only see the BT classic devices in that settings. However, only few protocols could be used without a required MFi chip, which is out of your scope for your Hobby project.
Use The CoreBluetooth on the iOS side for your app.
UPDATE per #Brejuro request in the comment below:
MFi coprocessor is required to be in your custom HW, which wants to communicate using the majority of profiles/protocols defined for Bluetooth Classic (not LE), e.g the pure RFCOMM. Coprocessor is used for the initial authentication - then, iOS knows that your custom HW is certified and allows to use it.
However, Apple will ask you for big money and your device needs to pass through Apple certification - that's why I told that this is out of the scope for any hobby project. You will also need to sign very restrictive NDA. However, you will get very very good documentation describing many details.
Built-in Bluetooth panel in iOS Settings app is actually a merge of two different things:
a list of known (paired) devices whatever the profile they use (so that you have a central place to unpair them),
a tool for discovering nearby devices to pair to.
Unpaired devices will only show in discovery list if they actually implement at least one profile that is recognized by core bluetooth services of iOS. Other devices are masked (user would not be able to do anything useful with them anyway).
If you hobby project is to do something related to built-in supported devices, like HID (keyboard, mouse, remote control, etc.), you will actually see them during discovery from Settings app.
If you create a device with a custom service, with your own Service Type UUID, it will not show in built-in panel, and your app will have to look for it for pairing. Once paired, device will show in settings.
Out of core services, you can also make compatible devices without being MFi. For instance, MIDI over BLE profile is such thing that gets recognized transparently by garageband and other music apps.
Using BLE and not BR/EDR, Authentication chip is only required for very specific profiles, like HomeKit.

BLE device awareness of the IOS mobile Presence and Absence

We are developing a bluetooth low energy device for a home automation application.
We are facing a major questioning for which we need help.
Here is the use case:
The device needs to have the awareness of the user IOS phone presence or absence in the house.
The BLE devices are working on peripheral role, the IOS should therefore work on central role.
The IOS App is mainly running in background mode.
For the presence detection awareness , we think it can be obvious: the phone whenever entering into the range will discover the device and initiate a connection to inform its presence to the device.
However we are struggling to find the absence detection method.
How shall we implement the absence detection awareness so the device would know when the user is not at home?
Any suggestions are welcome.
I think this can help you ,
During initial sync of your iOS device with peripheral basically when you are writing configuration settings on the BLE you can save the iphone's UUID of the user on ble but still you have to get the UUID of iPhone when user is in the range.

prevent camera from working based on geo location(iOS, Android)

Is it possible prevent camera or microphone of iPhone/Android from working based on the location of the device?
I want to make the functionality of camera or microphone disable in the certain area.
Is it possible in iOS or Android?
Are there SDKs, solutions or libraries?
Thank you.
For Android you can use the Device Administration API to lock all cameres of the device. The camera (and flash) will be disabled for the user and for all the apps. Regarding the geo location you should retrieve the device location (Network/GPS) and switch between lock/unlock according to it.
For ios it is possible to disable the camera app via a Mobile Device Management (MDM) for Enterprise deployment.
I don't know if it is possible to do it dynamically based on the device location. I will appreciate if someone will response to this qestion too.
As #rmaddy says, you can't do this for iOS, unless you are targeting jailbroken devices. And on a jailbroken device all bets are off, since the user has root access to bypass your restrictions.
As a matter of policy Apple does not allow third party apps to alter the base functions of the device. Apps run in "user space" in a restrictive "app sandbox" and can only modify themselves.

iPhone Simulator magneticHeading?

I have created an app that I want to know the magneticHeading. I have coded it in every way possible that I thought it would work. From there I have been testing my app on the simulator but it wont give me the magneticHeading Value.
I have looked for this before and I believe the answer is that the simulator will not give you this value. I haven't found anything that flat out said it so I just want to check with the community for my exact situation:
Will the iPhone simulator give you the magneticHeading Data.
Would it with a gpx file?
Your assumptions are correct because the simulator does not have the required hardware, which in this case is the magnetometer. You can determine way points, routes etc with a .gpx file but as far as orienting the display to correlate with the direction the user is facing, you'll need a compass. Testing on an actual device with the required hardware would therefor be preferable.
The use of location services requires user authorization. In addition, some location services require the presence of specific hardware on the given device. For example, heading information is available only on devices that contain a hardware compass.
This is taken from CLLocationManager Class Reference
For a list of devices that have the magnetometer hardware have a look at iOS Device Compatibility Reference

iBeacon transmission when app is closed?

We would like to use some configuration of the iBeacon , where the user's iPhone will advertise its services, but when the app is closed.
So when a user come across a hardware beacon, it will recognise the user's iPhone(as a beacon) without opening the app, and even connect to it .
I could find here many opinions about that, but i wonder if there are any news with the iOS8 ,and if there is a clear answer for that from Apple ?
A couple of points:
Bluetooth beacons, iBeacons included, are transmit only. They don't see or "recognize" other beacons or phones. The statement "when a user come across a hardware beacon, it will recognise the user's iPhone(as a beacon)" is not possible with the technology regardless of whether the app on the phone is in the foreground or the background.
iBeacons are supported on iOS devices with version 7.x and 8.x of the operating system. On all these versions, however, beacon transmission from the iOS device is only supported when the app is in the foreground. See here for details.

Resources