how can i call background application from ui Application+blackberry - blackberry

i am trying to make a uiapplication
If i click on a button then a background thread must start which should run even when my application is exited how can i do that
I created a background thread but it gets stop when the app exits.

Create your application as a system module that starts automatically and runs in the background. You can have an alternate entry point that will pass an argument to the main app to start your GUI. When you exit the GUI it won't exit the entire application.

Create 2 seperate project - making one dependent on the other if need be.
Then use GlobalEvents and GlobalEventListener to communicate between them when the one is in the foreground and the other in the background

Related

What are the different options for running code at a specified time in iOS?

What are the different options for running code on an iOS device at a specified time while the app is in the background? So far I have found that I could possibly use a Timer object, use the Grand Central Dispatch timer, and use CloudKit Push Notification with the Apple Push Notification service.
Any ideas are welcome. I'm having a hard time finding the solution.
Here is the apple documentation for background execution.
Here is the apple documentation for the execution states of an application.
You should understand a few things:
When an app moves into the background you have a very small amount of time (3 minutes approximately) to execute finite-length tasks.
If your application is not running, you could use a notification to wake the application. This requires the user to take an action and will make the application active.
You can also wake an application with a local notification, it doesn't have to be a remote notification.
The code that you want to run really needs to fall into one of the blessed scenarios that apple defines otherwise you run the risk of being deprioritized or ignored entirely.
A block of code scheduled to run with a Timer or GCD will not be invoked while the application is in the background.
Roughly, you should register a background execution mode and follow the guidelines I linked above and while your application is backgrounded the application will be given time to execute code.

Implementing a service in background on iOS

I have a custom framework which the client app can consume. I want the framework API's to run even when the application enters the background. How can I achieve this?
Thanks in advance.
It depends on what your app is doing after entering the background.
Perhaps you are looking for UIBackgroundTask. You can take a look at the method beginBackgroundTaskWithExpirationHandler: of UIApplication.
This method lets your app continue to run for a period of time after it transitions to the background. You should call this method at times where leaving a task unfinished might be detrimental to your app’s user experience. For example, your app could call this method to ensure that had enough time to transfer an important file to a remote server or at least attempt to make the transfer and note any errors. You should not use this method simply to keep your app running after it moves to the background.
Background execution on iOS is a very advanced topic.
Without any details, all I can do is forward you to the official Apple documentation.
This explains ALL possible modes that allow your app to run in background.

how to start process in background/Terminated iOS apps

I want to start some process in background mode on timer event.i want to know that is it possible to get start any process in background or terminated apps on timer event,if i set timer for Five minuets and close the app not even running in background mode than after five min process should start automatically, is it possible in iOS?
I have read my Documents and also tried out this Scenario, I have concluded that Apple doesn't provide any background Process while app is terminated excluding Push Notification.
If you want to run any background process then app must be active in background.

Running an application in the Background?

My application runs in the Background (getting location updates) which I need to push to my server for every 10 seconds.
I have scheduled a timer which invokes a function in which the current location updates are captured and pushed to the server. This is running smoothly if the app is there in the foreground. When the app is moved to the background this functionality is running for 15 minutes after which I cannot see the method being invoked at all.
I know if an application is put into background it will be put into suspended state at any time. Also if another app running in the foreground requires memory at that time iOS may terminate some applications in the background. But in my case no application is running in the foreground as I have locked my device.
I also have an idea about expirationHandler. Would like to know if I can keep calling the function in the background without my app going into suspended state and Apple should accept that.
Any suggestions are welcome.
You can add App registers for location updates under Required background modes in your plist.
The same scenario was also in my application i have set the uibackground mode in plist file and use that service from appdeligate and apple approved that application :)
Hope it may help you.

Repeating a certain method in iOS even when app is in background

I am developing an application that parses some data from web and puts it into a tableview. It is now working only when the user tells the app to do so (by clicking on a certain cell), but I want to change that or rather add a functionality, that would simplify user's life and parse that data (for example) every hour. I was thinking about Local notifications, because that is the only thing I am aware of that runs even when you kill the app. So the question is:
Is it possible to repeat a certain method or functionality in an app till (for example)the user disables this option? Is there something like a service that is running even when the application is in the background or even killed?
Can this be done by a local notification? How?
Or what is the appropriate way to do it?
Thank you
Is there something like a service that is running even when the application is in the background
See, for example:
Running iOS App In The Background
Your app can run in the background only if it is performing certain permitted kinds of activity.

Resources