IOS app without any UI - ios

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.

Related

Can I do a background api call when the app is terminated/killed by the user in react native?

Can I do a background api call when the app is terminated/killed by the user in react native?
I tried with react-native-background-actions & react-native-background-timer.
Working fine in android but not in IOS when user terminate/kill the app
iOS have stricter policies about allowing background tasks to run when the app is killed, probably thats why you are facing this issue. Its not impossible to achieve what you are trying to, however its not very reliable, given that apple have full control of these tasks and when/if they are executed. You can try https://github.com/transistorsoft/react-native-background-fetch, its very well documented and might do the job for you.

Force iOS app to open in foreground using private APIs

I'm currently working on a kiosk type application that won't be distributed on the App Store. The device will sometimes need to switch applications to handle some other tasks, but in the case where a user doesn't manually switch back, I need my app to come to the foreground after a set amount of time has passed.
We don't have control over the other apps, so getting them to switch to ours after a timeout isn't possible.
I know this can't be done through official means, but I'm asking if anyone knows of a private API I could call from within a scheduled notification that will foreground my application.
I have a feeling that this cannot be done without a jailbreak due to the sandboxing nature of the apps, as in, there's no way to send a message to whatever service launches apps on the device. Although it should be possible, as the demo devices in the Apple stores are able to revert back to a demo "screensaver" app if left alone for a while. What are they doing to achieve this?
If there is a jailbreak hack for this to work or a config or something an MDM service could handle, I'd be happy to try that out.
Again, this is for a private application that will not be distributed on the App Store. The app will be placed on devices located throughout our building and running on our internal network.
Via Jailbreak you could look at something like AutoLaunch:
If you use a particular app that seems to crash here and there, then a new free jailbreak tweak called AutoLaunch could be your next best friend. It can automatically re-launch any app that crashes on your device so you don’t have to re-launch it yourself.
http://www.idownloadblog.com/2017/01/08/autolaunch/
Not sure how much control you'd have over wanting to launch regardless of whether it's crashed or not. You might be able to ask the author to provide the source-code or work with him to get your desired result.
UPDATE:
It's open source:
https://github.com/chenzhijie/autolaunch
Upon further inspection of the source it looks like it uses the following to launch the application after a crash:
int createSubProcessResult = fork();
if(createSubProcessResult == 0) {
execl("/usr/bin/open","open",[currentAppBundleId UTF8String],NULL);
}
I guess you could roll your own version of Autolaunch and have it wait/subscribe for a remove command that'll launch/switch different apps.

Launching iOS application in background from another application

I am not aware much of APIs of iOS and its internals.
However, i want to run an application A in the background (not to launch application A in foreground) from another application B and do some tasks like downloading of content.
I would like to communicate between the apps using URL schemes.
In Android, it is possible to trigger an Android service in the background using implicit/explicit intents (URL schemes). I am looking for similar kind of APIs/components in iOS.
If not the whole application execution or any custom logic. Can I just execute NSURLSession from URL schemes which are used as a background content transfer job in iOS?
Best Regards,
Saurav
No and Yes
No, You cannot run another app from your app in background, but you can open it into foreground
Yes
If app A and B is developed by you, you can trigger a push notification from App A to B. B on receiving can execute your download code in background

how to open another application from background using Custom URL scheme in iOS

I want to develop an Enterprise Application. It will run in the background continuously and from the background i want to open an another application. Its like toggle between two application. I have implemented forever background running with help of Location services which is working fine and also updating the location from the background but it is unable to execute openURL method.
Please suggest something.Thanks
It's not possible!
You can use these links only.
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html
I will extend a little bit on MobiDevCom answer.
I haven't found a good publicly known solution.
The direct approach (trying to open something from background using all kinds of public or private API) ends up requiring all kinds of entitlements. I tried at least dozen of things about a year ago and reverse engineered quite a lot of iOS components.
The only idea which I found was usage of MDM Guided mode (however, a device needs to be supervised and enrolled into MDM for that).
BTW. Here is the question which I asked - Show some UI from background in audio player or VOIP app on iOS

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

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.

Resources