How to create background services to run even when the app is killed, in iOS? - ios

I need to create a android equivalent functionality in iOS, which records GPS and other sensor readings even when the app is killed, in iOS that would be, when the app is swiped from the app switcher.
In android, the Service class is able to do this. The notification stays there in the notification panel and you cannot swipe it, unless the app allows you to do so..
Many apps add widgets to the notification panel using this functionality like, clean master. Clean master widget floats in the notification panel and does most of the functionality which the app does it self.

IOS does not has any background service concept. Yes, you can use GPS location when user app in background but it will not work when your app is totally close.

Related

How to bring IOS app from background to foreground without using local notification?

Is there any way to bring the app to foreground which is running in background without sending any local notification?
There is no way for you to programatically foreground the app. If you think about it, allowing developers to do that could have significant consequences to user experience.
There must be a way to simulate it.
Uber Driver's App launch when the user gets a new ride with app in background.
WhatsApp in background opens a phone view when somebody calls the user.

Is it possible to detect another application from the current app in iOS?

I need to create sticky button which is on screen like hike button in ios
If i detect that application(WhatsApp) state event so i solve this problem. Thats why i need to create another application launched event.
Thank you in advance.
Apps on iOS are sandboxed and can not directly communicate with other apps directly. There are some API's in the iOS SDK which allows some interaction, mostly audio, share of items.
Apple does not expose to you app if an other app is launched, so checking that an other is launched is not possible.
The second issue is that you can draw on de screen outside of you own apps windows. So you will not be able to draw a button on top of some other app.

iOS - App in Background vs Local Notifcations

I'm building a project which is something like an Alarm Clock app. I know there are inherit limitations here (as compared to the built-in Apple Clock app) but I'm trying to assess if these limitations will be a blocker.
In the end, I need to be able to schedule an alarm/notification at a certain time, and have it sound when the phone is locked. Furthermore, I want to be able to interact with the app from the lock screen (including shake and volume gestures).
Does this require me having the app run in the background, and scheduling LocalNotifications? If its in the background, and the LocalNotification fires on the lock screen, is it possible for the User to interact with the application? i.e. With the app SleepCycle, you can shake the phone from the lock screen to trigger a Snooze. Is that sort of functionality possible only because the app is running in the background (in the case of that app, I know it's running in the background)
yes. you need to be running in the background for interacting on the lock screen

Running a back ground service in iOS8+

I have an application which needs to connect to server whenever the iPhone is active (i.e when the display screen is on). For this to work I need below 2 things.
In android we have combination of
BroadcastReceiver to get notified when the screen is active
Services to run the app process in the back ground to accomplish this task.
But in iOS I couldn't find any such service. Is there any way I can accomplish this task in iOS 8 ? Are there any equivalents for the above 2 in iOS ?
Check out this part of the documentation on downloading data in the background. You'll want to implement application:performFetchWithCompletionHandler: in your AppDelegate, turn on "Background Modes" in the Capabilities (find by clicking top item in Project navigator, the one with the blue icon next to it), and checkmark "Background fetch".
Note that the system decides when to call application:performFetchWithCompletionHandler:-- it is entirely opaque to us. It is only called when your app is not the app running in the foreground.
I don't know of any way to get a notification every time the device is unlocked.

Changing the behavior of the iOS Lockscreen

Is there a way to change the behavior of the iOS Lockscreen? For instance, can an app, if active, provide a user with dynamic content, such as pictures, as the phone's background, and, in addition, allow a user to swipe left (in addition to swiping right, if they want to unlock the phone) to engage said content?
Is there a way to change the behavior of the iOS Lockscreen?
No.
For instance, can an app, if active...
No.
iOS doesn't provide any API that would allow the sort of thing that you describe. It might be possible to modify or replace the lock screen if you jailbreak your phone -- all bets are off at that point. But an app that uses the Apple-provided API has no way to modify the lock screen.
Also, note that if the device is locked, your app won't be active. You may have intended a looser definition of "active," but looking at the linked chart of app states will help you understand that what you're looking to do isn't achievable with the current API. Apps have to be active to receive events, but a locked phone implies that your app will be in an inactive, background, or suspended state if it's running at all.
No. (Not if you're talking about an 'app' in the sense of the App Store)
The only way an app can interact with the lock screen is through notifications, and cannot alter the standard lock screen interface.
You can alter the lock screen with a MobileSubstrate tweak on a jailbroken phone, but this requires reverse-engineering SpringBoard (the iOS launcher app), can be quite complicated and obviously cannot be distributed through the App Store

Resources