Application which work in background only iPhone - iphone

I have requirement for an application which work in background only.
When first time application install on device then after installation that will be go to background. And after two minutes a view will popup on screen.
Now problem is that after installation how to redirect application into background?
i get answer for this that if we want to send our app into background then we have to open another app like as safari. so i get this solution.
Now problem is that how show a view after two minutes from background. I have to create as a demo not for app store. So if anyone have any solution then suggest me.
Thanks

It is not possible to do so in iOS. You can't send an app into the background
If you want your app to get displayed, the only way to do so is through push (from server) or local (from phone) notifications, and the user has to explicitly accept it.
Unfortunately, you can't make it open automatically.

iOS is not designed to run code in the background. There are a few exceptions, for example a music streaming app, or a GPS navigation app, but in general it cannot be done.
Instead, you should run your app on a server in the cloud, and send a push notification to the phone when you want something to happen on the phone. You may also be able to achieve this with "local notifications", depending on what you're trying to do.

Related

How to open an app automatically when app notification appears with Swift

I want an app that can be opened automatically or by itself when app notification appears. I've been looking for this case but I don't find any solution.
This is not possible on iOS. You can not programmatically open an app based on a notification.
What you can do is to use silent pushes (those are push notifications that are invisible to the user) to wake up your application in the background. Using this mechanism, you can do some work in your app in the background (like fetching some data so it is instantly available later on).
Depending on your use case, this might be of use to you.

How to keep user notified that application is running in background?

Since few days i am searching for the functionality which will allow me keep user posted that application is running in background. I have attached a !image for what exactly i am looking for. i tried googling but could not get exactly what I need. when i tap on the flashing red bar it takes me back to the application.
Thanks in advance.
The red banner you pictured is provided by the system, is shown only if your application uses background audio recording (see AVAudioSession), and doesn't provide the opportunity for you to choose what happens when the user taps it.
Unless your app fits into one of a few specific classes, it doesn't actually "run" while in the background. Instead, it's "suspended" -- still in memory, but gets no CPU time. What happens outside of your app is thus up to the system, not to you... the only way to show a banner that will launch your application is to use a push notification service or UILocalNotification, but those banners are only shown briefly, and you don't get to control their duration. What you seem to be specifically asking for isn't possible using public API.
The kind of notification you want isn't supported by the current iOS for third-party developers.
If you want that kind of functionality then implement Apple Push Notification service through
this you can first give message to Apple push notification service. then Apple service
automatically generate notification for your App as you want.

Is it possible to quit iOS app after we do some checks

We don't want the user enter our app if the app is out-dated.
Is that is possible to quit a iOS app when we do some date check BEFORE the app launch?
Or it is possible to quit the application after the main view is loaded?
Before the app launches: no. The launch animation is already in progress when the OS calls main.
After some time (1-2 sec): yes. You can use one of
[[UIApplication sharedApplication] terminateWithSuccess];
exit(0);
abort();
assert(0);
pthread_kill(pthread_self());
so many ways, but neither will go through AppStpre - you're not supposed to close your app programmatically. You're supposed to notify the user via an UIAlertView about the outdated app and disable interaction with the app.
According to Apple you cannot exit(quit) your application through code. i.e if you use exit(0). Your application will be rejected for that. Although you can use exit(1) and delay the exit time of your application. Or you may like to use local notification which is quite handy.
Don’t Quit Programmatically
Never quit an iOS application programmatically because people tend to
interpret this as a crash. However, if external circumstances prevent
your application from functioning as intended, you need to tell your
users about the situation and explain what they can do about it.
Depending on how severe the application malfunction is, you have two
choices.
Display an attractive screen that describes the problem and suggests a
correction. A screen provides feedback that reassures users that
there’s nothing wrong with your application. It puts users in control,
letting them decide whether they want to take corrective action and
continue using your application or press the Home button and open a
different application
If only some of your application's features are not working, display
either a screen or an alert when people activate the feature. Display
the alert only when people try to access the feature that isn’t
functioning.
Source

iPhone - is it possible to "awaken" an app after a certain time?

I was wondering if it was possible to have an "alarm" style app that would run at a certain time? Would the application have to be run and then left open?
I know with multi-tasking on the iPhone 4 a user could open the app and run it in the background. If my original question isn't possible, is it possible to bring an app running in the background back into the foreground after a certain time?
Thank you very much for your help.
Have a look at the new 4.0 feature called Local Notifications. Local and Push Notification Programming Guide
You can use EventKit to put certain alarms. It is however not possible to schedule to launch of your app. You can not bring your app forward like you suggest. You could however send a push notification. The link suggested by Jessedc gives a lot of in-depth information about the use of this.

Opening one app from another app without closing the app

In the home page of my iphone app, there is a button added. When that button is clicked some other iphone app needs to be opened in a new viewcontroller (with out closing the parent app).There will be a back button on this view controller. When the back button is clicked, the new viewcontroller which is showing the another app needs to be closed and our parent app's home page needs to be shown.
Please give me some ideas on how to do this. I googled for this i didnt get any solutions.
Thanks,
Raja.
-- the following applies to iOS versions previous than 4.0 :)
Actually, there can be only one iPhone application running at once (with exceptions of Safari, Phone and some other system applications). The iPhone Human Interface Guidelines say so:
Only one iPhone application can run at a time, and third-party applications never run in the background. This means that when users switch to another application, answer the phone, or check their email, the application they were using quits.
However, if you only need to e.g. show a webpage, you can do it using UIWebView
Also, if you need to open another application, you should use URLs as pointed by Steve Harrison. This will, however, close your application. The recommended behavior in this case is to remember your application state and restore it when the application is run again, as Nithin writes.
According to apples documentation, they are not allowing any applications to be run in the background, except system generated ones. So you will be unable to do the thing you are going to implement. However, there is one thing that can make the same result.
You told that you are calling other application to run on a button click. Before initiating that application, save the current state of your application, may be using sqlite3 or core-data, and then open the other one. While returning back, load the pre-saved data from the database or wherever you have stored it. Every time you start the application, you check for the persisted data, if exists, load it or otherwise load your basic view
I don't think that you can run other iPhone apps within your own one. It doesn't make sense. You can open another iPhone app via a URL (see here and here), but this will close your app.
Like it has been stated: running two apps is not allowed by apple. You can however implement this apps features into you're app and have both get and save data to the same server...
Or like Nithin said: this functionality is available on JB iphones. Look into "backgrounder" for implementing one solution for normal users and one for thouse that has jailbroken.