iOS Question Background Task in Debug Mode

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello all,

I just started to use B4XPages to convert some Android Apps to Ios and noticed that background tasks those were running in Android using a timer in the B4X pages class aren't working when the the app is changed to background in IOS (in debug mode).
Is there any restriction to run an app in background in debug mode in Ios? I noticed that, after some seconds, the connection from B4i bridge is released when the app is in background. Is there any special configuration that is required or this behavior is a characteristic of debug environment in IOS?

Thanks!
 

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Both Android and iOS will kill the app at some point when it is in the background. iOS will do it faster.
Then, I think that the solution is the same for both: use push Firebase to restart when required correct ?
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Push messages will not start your app in iOS. Only show a notification.
Hello @Erel ,

Then, is there any way to maintain an IOS App running in background to do periodic http requests for example ?
In Android I use Firebase push to start a service ... Is there any similar process in IOS ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Then, is there any way to maintain an IOS App running in background to do periodic http requests for example ?
There are very specific and limited things that you can do in the background.
You can download in the background:
Background Fetch (Downloads)

In Android I use Firebase push to start a service ... Is there any similar process in IOS ?
Search for silent push notifications and do note that they aren't very reliable.
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
There are very specific and limited things that you can do in the background.
You can download in the background:
ok @Erel ... after your answer , doing some search, I found this: https://apple.stackexchange.com/questions/252239/do-ios-apps-run-in-the-background
IOS is VERY limited !!! In fact, very few can be done in background unless you have Apple permission ! That's why I'll always prefer Android...

Search for silent push notifications and do note that they aren't very reliable.
Yes, I know. I use Firebase Push in a business message app and had to combinate with periodic samples because sometimes FCM doesn't trigger the app, even in Android. But in Android, if the notification is important for the user, we always have the choice to start a foreground service (with a permanent notification, but if the service is important this doesn't botter the customer) and have reliability with periodic samples if required (15 seconds in the most of the cases is enough). But it looks that this is not an option for IOS right? Unfortunately... solution: to instruct the customer , if he wants reliability, to use Android.:)
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
iOS push notifications are reliable.
The problem starts when you need to do more than showing a notification.
In our situation, for example: I need to show a notification that is very important to the user. Then, it's required to keep ringing until he opens the screen and release or click on it. Is it possible in IOS? Persistent and periodic "ringing" notifications?
 
Upvote 0
Top