What's solution to make task background in iOS same service in Android? - ios

I'm newbie iOS. I have been develop Phonegap for Android and iOS. My App is update data from server every 1hour. In Android, i use service to do that. My app in Android working very good. Now, i want to develop version for iOS, and i have problem when update data from server every 1hour. I was research but not find anyway for my app.I don't know what's solution to replace for service in Android. Can you help me, what's solution. This have been kill me. Thank you so much.

Short answer is NO as Apple has restriction on background task running especially cases like yours.
But if you are downloading small amount of content, you do have some other options. From IOS 4.0 or above, you can declare your app to run in background when you fall under the following categories:
Audio
Location updates
Voice over IP
Newsstand downloads
External accessory communication
Bluetooth networking
Bluetooth data sharing
Background fetch (IOS 7)
Remote notifications (IOS 7)
In order to do so, you need to flag your app in the info.plist for Required Background Modes option. Apple will review your app specific in this area once you declared the option.
For your case to download the data, the possible option is to use the new feature in IOS 7 that's the background fetch or remote notification above. The suggestion from DOM was not asking you to download the content through push notification. But instead to use push notification to wake up your application and start downloading new content.
If you don't want to use push notification, the only way to go is register for background fetch. However, no matter which option you want to use, each download will only last for 30 seconds. And after that, your app will put into suspension mode again.
you can have a look on the link here:
Declaring Your App’s Supported Background Tasks

I think your best bet would be to use the push services instead of having your app go get data. Making your app do it is unreliable with phonegap apps because you cant create a service interface and you can not guarantee that your app will be running. With push service though, if your app isn't running, it will be woken up in a manner of speaking.
Take a look at this great how-to article that also discusses what push provides you.

Related

IOS app without any UI

I have no knowledge of iOS. I need to know if it is possible to create an application without any views. The app should run a background service triggered by the app installation (or boot), and the service will run permanently.
If you click the app icon, nothing should happen.
Thank you
This is not possible. There is no such concept as a service type application or functionality in iOS.
The reason is, the UIApplication class provides a centralized point of control and coordination for apps running in iOS, which is a part of UIKit.
Also, there are restrictions to run the background service in iOS.See the below pic and this link to know more about background modes for apps.
Possible Method:
This is possible by writing exit(0); inside the didFinishLaunchingWithOptions after the iOS supporting background service is initiated. However, the App-Store will reject your app.

Program an iOS app to launch itself at specific times

I'm developing a medical alert and record keeping app for iOS for a client. The app needs to be able to open itself at specific times based on a schedule that is set remotely.
I've searched around for how this can be done, and I keep running into other apps that let you schedule app launch times, but this needs to be a self contained solution.
I'd rather not JailBreak the iOS device to make it work, and I've come across articles that say iOS 9+ now has this capacity, but no instructions on how to make it come about.
Any clues, tutorials, or other information on how to accomplish this?
You can use "silent" push notifications (with "content-available") on iOS 7+ to launch the app when the push notification is received on the device. You will get a chance to process the notification, and the app will be launched if it's not already running.
However, it still won't work if the user has force killed the app.
Also, iOS will not launch your app if it feels you've gone over the daily processing time or data quota.

IOS limitations when running on background

I searched informations about possibilities when running an iOS app on background, but I didn't found same on different sites.
My application has to read the battery level (with step of 1%) and the time, but I don't know if I can read that when running on background.
Please if someone is sure about it or know a site to read these infos, it will be very nice.
EDIT : I've one more question, can I just open my app (to perform more actions) when the notification center return a battery state under 5% for example ?
No, you can't.
It's not possible to let your app running on background, it's iOS system's limitations.
In iOS 7.0 and later, you have opportunity to do some pre-fetch stuff even your app is not running, through the method like application:performFetchWithCompletionHandler:, but you should tell the device by posting remote notification from your server.

Auto restart iOS app for enterprise, not jailbroken

I'm currently developing an app using enterprise account for internal purposes only.
I heard something about daemon for jailbroken devices in order to make my app just like an android service.
Is there anything I can do when not jailbroken?
Maybe 3rd party framework or piece of codes? Maybe private framework?
Something like this maybe: Make the application restart by itself on a jailbroken device
But for non-jailbroken.
P.S. - The app of course is not for app store and could not be on app store.
I agree with Tander. But we have achieved almost similar effect using combination of SLC (Significant Location Change), Background fetch and Silent push notifications. Whole point is that app periodically trigger call to API to let know it is alive.
If this fails, we sent normal Push Notification. I was looking into this for fair amount of time and didn't come up with nothing better. But note that you get very limited process time to execute code using this options.
Unless the device is jail broken the short answer is no.

How to update Geofencing list of points in iOS into Background

I would create an iOS application with geofencing.
Can I send a new list of geofencing points to this app through Apple Server in Background or must I launch the app to update its list of points ?
More easily, can I from an external server change the geofence point without launching the app ?
Thanks you very much.
Best regards
Assuming your app doesn't use any of the available background modes, you can't change them remotely. The push notifications are received and shown by the OS, and only opening them will trigger your app to load and execute your code.

Resources