How to persist communication after shutting down/turning on the device? - ios

I'm developing an iOS application to keep track of certain system information from the device. The application is supposed to keep sending information even if it is in background. Everything is working fine but when I shut down the device and then turn it on, the application is still in background but it won't communicate the information. Can someone help me to become active my application after turning on the device?

when I shut down the device and then turn it on, the application is still in background
No, it isn't. The app launcher pretends that it is, but in reality it's been shut down. And there's no way you can re-open it programmatically (even less chance for opening a currently dead process from within itself....) - The only reasonable solution I could think of is jailbreaking the device and hooking into SpringBoard so it re-launches all open apps upon reboot, but I don't believe that's a viable option for you.

One way you could achieve this is by the application creating local notifications. These will persist through shutting down the device.
See this fine tutorial: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/

Related

TokBox iOS - App Background process singal not working

We are facing some strange issue in the iOS app , we are handling the signal when app in background mode.
It's perfectly working in xcode simulator and the same thing it's not working in real iOS devices. The signals not receiving in app background mode.
Do we need to enable any settings in iOS devices to handle this?
And, It's perfectly working in android devices.
Please help on this.
(Also Project->Capabilities-> Background Modes -> Audio,AirPlay,PIP is enabled for this to work in background.)
Apps sent to the background are generally expected to get suspended unless there is a reason for the process to stay running. In the case of using the OpenTok SDK, usually this means the app will be suspended unless there is a Publisher and/or Subscriber running -- background permission is tied to the AVAudioSession.
If you are trying to just keep a session connected without any subscribers/publishers while the app is in the background, this is not a recommended implementation. Keeping a websocket active for an OpenTok session requires trickling data every few seconds, creating an unnecessary burden on energy and data costs. For this reason, it is recommended to do your offline signaling via APNS rather than through an OpenTok session.
I trust you may have already seen this, but just for completeness, a more in-depth writeup on the topic is available here: https://tokbox.com/developer/sdks/ios/background-state.html
Disclosure: I work for TokBox.

iOS app to lock screen or turn off device after a specific time

I have experience programming in OS X but have never programmed in iOS. I want to create a special iOS apps for my special needs to prevent my kid from spending too much times in my IPhone/IPad. It's a simple app which allows the user to set the time and once the time elapses, the device can be either turned off or its screen will be locked.
May I know whether this is possible and what are the APIs involved? I just need a very brief idea for me to kick start.
Thanks in advance.
Your requirement is really special.
Unfortunately there is no way to lock your iOS device or automatically shut down it, unless you jailbreak the phone.
I would set the device to Kiosk Mode (Guided Access) or Single App Mode (Using Mobile Device Management). This will prevent your kid from exiting the app.
You could then program your app to stop responding after the elapsed time. It can't shut down the device, but should lock the screen after x minutes of inactivity (configured in the settings).

iOS keep app always alive for home automation purpose

I'm building home automation system for my house.
The plan is to have lots of different rfduino nodes talking to one wall mounted iPad through the bluetooth.
So far all working perfect apart from keeping an app alive all the time, device is plugged to the charger.
My question is rather simple and I struggle to find a solution.
How can I keep the app always alive to do its processing but with the screen disabled?
Thanks in advance

iOS refresh bluetooth characteristics

I have created an iOS app that interacts with a bootloader on some custom hardware/firmware to update the application on the hardware. In order to accomplish this, the hardware/firmware has a bootloader application and a regular application. First, I connect my iOS app to the bootloader application and update the regular application. At which point the regular application starts to run and I would like to connect to it with my iOS app.
If I search for peripherals with an Android application it correctly sees my hardware broadcasting as the bootloader application and then switch to broadcasting as the regular application after the update has been completed. However, for some reason, the equivalent iOS app only sees it being broadcast as the bootloader application. I have found that if I restart the iOS device or if I turn the iOS device's bluetooth off and back on after a few seconds it will finally recognize that the regular application is broadcasting.
It seems as though the iOS device is caching the peripheral information. Does anyone know if there is a way to clear the cache or refresh to get the current/valid status of the device?
I have exactly the same issue here, unfortunately this is indeed due to iOS. There are a lot of other threads about this topic but after looking for a while I would recommend this answer :
https://stackoverflow.com/a/25930825
Best of luck, I haven't finished yet and this won't be easy...

Geo Notification on app that is off

Geo Fencing is praised by many, yet I could not easily find an answer to the following.
iOS and/or Android, does an inactive app send you notifications if you are close by?
My question is probably more like: is there an underlying system that knows your app needs to check for your location against the in-app locations and does so despite the app not being active.
Forget the settings where you can switch off geolocation for particular apps, let's assume that is switched on.
But let's assume I just switched my iphone on, no app is running yet. So I am carrying that sleeping phone in my pocket. Would I receive location notifications?
I am currently testing this with Highlight, but maybe someone knows the code/tech side to this answer.
Varies by OS.
On Android, apps can run as a service that are automatically started when the phone boots up. In this case, the user does not need to start the app. So, on Android, yes you would receive location notifications in sleep mode. See http://developer.android.com/guide/components/services.html or https://stackoverflow.com/questions/9866970/tutorial-for-android-services for more info on Android Services.
On Apple, I'm not so sure about running apps as a service like Android. However, I believe there are events that apps in the background can register for. So again, the app (once started) would receive notifications in sleep mode.

Resources