How to get status of system Haptics setting programmatically in ios? - ios10

In my app, i want the user to enable or disable haptic feedback. When the haptic feedback of device is off, i will not allow the user to enable it. I want to know the status of haptic setting in the device and if its on/off.

Related

Programmatically notification on apple watch. (WatchOS 3)

How I can programmatically make the notification appear only on the apple watch and only when the event occurs. I searched for a long time on the Internet and in the documentation but did not find the answer
There is no way for you to decide whether the notification appears on the Watch or on the Phone, the system handles this automatically and you cannot change this behaviour.
The notification only appears on the Watch if all of the below requirements are met:
The connected iPhone's screen is locked
The watch is worn by the user in case WristDetection is turned on
Do not disturb mode is turned off on the Watch

How to prevent the CoreBluetooth library from prompting to turn-on an iOS device's bluetooth?

I would like to detect whether an iOS device has Bluetooth enabled so that I can prevent the CoreBluetooth library from prompting the app user to enable it. I am NOT looking to check the state of the CBCentralManager; I just want to prevent the blue popup box so that it doesn't annoy my users.
You can't use CoreBluetooth in your app without the dialog. So if you want to prevent it all together, you can't.
If you just want to prevent if if they have Bluetooth off, then checking the state of CBCentralManager first is the right approach (ie check to see if it == CBCentralManagerStatePoweredOff).

Is it possible to flash a flashlight in iPhone when application is background mode?

Is it possible to flash a flashlight in iPhone when application is background mode?
Please give some suitable suggestion.
Already given the answer similar of your this question, pls see this link at once
Iphone flashlight not working while app is in background
This is a normal behavior.
Apple's sandboxing will not allow you to keep the flash on while your app is in the background.
There is no workaround unless we are talking about a jailbroken app.
Edit:
Apple is very strict on it's system's APIs usage. Especially when it comes to:
- User privacy
- Battery life
- User experience
In the case of the flashlight, the last two items are relevant. Apple will not let an app drain the battery when not in the foreground and iOS users are used to the fact that flashlight, camera, microphone... are immediately disabled when going to the background (with an exception for the microphone in some background modes cases).
To answer the comment on your initial post, iOS controls your hardware. So since Apple decided they don't want the light to stay on when the user closes the app, iOS will just power off the flash when your app goes in the background. Your app has no authority to prevent it.
When in background your application doesn't work or get any messages from the system.
The only cases when this is allowed are:
navigation application
audio player
Internet telephony
Unless you are designing any of the above you can not flash the user with anything.
If you only want to notify the user about something, you can create a notifier that will pop a message in the users window even if your application is in the background or entirely off. the user can click the message and then he will be back to your application
My app is an audio player, so it keeps running in the background. But flashlight works only when it's in the Foreground. No flashlight from the background.
try AVCaptureDevice
AVCaptureDevice

How to be notified when iPhone enters airplane mode?

Is there a way for my app to be notified when the device enters (and leaves) airplane mode?
You can use Apple's Reachability code to see if a user has network access when they open your app or similar.
There is however no notification/trigger which your app can intercept/run arbitary code when a user enters or leaves airplane mode in the Settings.

How to disable GPS info from programming while taking picture/video on iPhone?

I do not want GPS information to be incorporated in the pictures/videos taken by our app, I could not find any api to disable GPS location information while using camera. I know user can enable disable it by going in settings etc, but I want to turn off GPS only for my app automatically so any camera (video/picture) should not use GPS at all.