iOS Question Run code when application is in background

Adilson Jacinto

Active Member
Licensed User
Longtime User
Hi there, hope someone can help me here, I previously had developed an application in phonegap build which allowed me to compile my html5 files in object c files to be able to upload my app on iTunes. Anyway when i developed I had a problem with background run because as soon you press the home button that pauses the app, but found a plugin for phonegap build which allowed me to overcome this issue "window.plugins.BackgroundJS.UnlockBackgroundTime", Then when I uploaded my app on iTunes, apple rejected it but they also said to allow me to use this background mode I would have to write a description that they provided me, and then I managed to upload it successfully.

Right now i am trying to the same with B4i but I don't know how to allow the app to run in the background?

Please help...

Thanks
 

Adilson Jacinto

Active Member
Licensed User
Longtime User
General applications are not allowed to run in the background. There are several specific features that Apple allow.

You can read more about it here: https://developer.apple.com/library.../BackgroundExecution/BackgroundExecution.html

Which one of these "tasks" is relevant for your app?

I have indeed read this article, and I need to use a long-running task in my app? I have a timer in my app that runs every 10 secs to check a values from my databse an then if it does it will notice the user. Can you help please?

Even if we have to force the app to run in the background. Like I said I have already done this with phonegap build using a plugin
 
Upvote 0

Adilson Jacinto

Active Member
Licensed User
Longtime User
Apple will reject your app unless you choose one specific task from the tasks list. You cannot just run an app in the background.

If you want to download some data from time to time then you can use background fetch mode: https://www.b4x.com/android/forum/threads/background-fetch-downloads.56022/#content

I tried to do something yesterday which it is weird, I created a timer which runs every second, then I created a variable "Count" and I increase this by 1 in the timer1_Tick and a label to display the value. Right I then click the home button and after 10 seconds and the values were still going up? So my question is, if the app does not run in the background how comes the values carried on running instead of pausing where I left???
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Release mode:

SS-2015-09-22_12.45.56.png


Note that the logs will not work in release mode. You can use this tool:
https://www.b4x.com/android/forum/threads/51164/#content
 
Upvote 0
Top