iOS Question Service module in B4I

wl

Well-Known Member
Licensed User
Longtime User
Is there anything similar to a service module (B4A): a possibility to run something continuous in the background ...

Thanks !
 

wl

Well-Known Member
Licensed User
Longtime User
I found these discussions: but one is talking about getting the location in the background, another in playing audio in the background. I'm not seeing anything generic to have background process.
Eg: How to keep a websocket open in the background and respond to data received ?
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
I think you can't .....
The app can't run in background. It seems there are some exception as you have seen (location, audio) but they will not suit your needs.
If you need to listen for informations coming from a server, you can write a B4J app on the server that send notifications to the app.
You can follow two methods:

1) remote notifications: the notifications just inform the user that there are new data, the user open the app (or click on the notification) and the app send responce to the server and do what you need.
2) silent notifications: the notification can be invisible but wake-up the app for a short time (I've read 30 seconds or so) to do some tasks and come then back again background.

Hope this help
 
  • Like
Reactions: wl
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Thanks: that was what I was afraid of.... I'm working on a push based application in B4A using web sockets (server side is indeed in B4J) and hoped to be able to do something similar in B4I without needing the Apple push mechanism ...

Elsewhere I read it could be possible if you mark your app as needing background processing for VOIP, but then probably your application would not get accepted by the Apple review team...
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Apple push mechanism is simple and works fine. The only problem is that it's a one way communication channel so when your server send the notification you can't know if it's really arrived to destination. If you send 10 notifications when the target is offline there is no buffer Apple side and the target will not receive the notifications when it comes back online. It seems it receives only the last notification sent when it was offline and the other 9 are lost.
 
  • Like
Reactions: wl
Upvote 0
Top