Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any equivalent of Services of Android in iOS?

I want to check the database in my app every 12 hrs for rows with date column having corresponding date. This is accomplished by writing service in android. But is there any equivalent of services in iOS so that my requirement can be accomplished?

like image 705
viks Avatar asked May 21 '13 10:05

viks


People also ask

What is the equivalent of activity in iOS?

We can say Activity is equivalent to ViewController, since it has its own lifecycle( onCreate in Android and viewDidLoad in iOS) but not fully.

What is iOS Android?

Google's Android and Apple's iOS are operating systems used primarily in mobile technology, such as smartphones and tablets. Android, which is Linux-based and partly open source, is more PC-like than iOS, in that its interface and basic features are generally more customizable from top to bottom.

Which OS is better Android or iOS?

Historically, iOS was considered to be a more user-friendly operating system compared to Android. However, its not true anymore. Both platforms have become extremely polished and easy to use. But, in general, iOS is slightly simpler and more streamlined while Android offers more features to power users.

Why iOS is faster than Android?

As Apple controls its production from start to finish, they don't require super-powerful specifications to compete with high-end Android phones. The Qualcomm processors of Androids are relatively slow compared to iPhone's processors, so this is why iPhones are faster, smoother, and better than Android phones.


3 Answers

No. There is no such thing in the SDK or in iPhone/iPad in general. You can only write code that will affect the eco system of the app, not the operating system. When your app is closed it's closed and no action will be taken until the user opens it/opens a push notification related to your app.

If the user approved location based services for your app, there are a few ways to run short background process even if your app is totally closed. One of them is by using Monitoring Shape-Based Regions which basically means if the user left region X/entered region Y open the app and run a few commands before closing it again.

The clever way (and the only way I can think of) to accomplish what you're after in iOS is to run that service on a server and pull the data from the server when the app is opened.

like image 131
Segev Avatar answered Oct 13 '22 20:10

Segev


In iOS7 and later you can use background fetch for this task. You can check this tutorial: http://code.tutsplus.com/tutorials/ios-7-sdk-working-with-background-fetch--mobile-20520

like image 27
Foriger Avatar answered Oct 13 '22 18:10

Foriger


You can find the solution here. Background Execution does this.

http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

Added: Apple does not allow apps to run in background for all the time. It provides some finite-length time to complete your app execution. You can increase that time depending on your execution need. But that is not recommended.

like image 40
Hawk-Eye Avatar answered Oct 13 '22 19:10

Hawk-Eye