Android Question Interprocess communication options for Android and iOS

Alessandro71

Well-Known Member
Licensed User
Longtime User
I'm posting in the B4A forum because of the bigger audience, but this is also about B4i and I don't want to cross-post the same topic.

Scenario:
- 2 different apps, a "producer" and a "consumer".
- the "producer" generates real-time data that should be passed to the "consumer".
- both apps runs concurrently on the same phone: the "producer" is a foreground service, the "consumer" displays the UI.
- both apps have an Android and an iOS version, but no cross-platform communication is required: the Android "producer" talks to the Android "consumer" on the same phone, while the iOS "producer" talks to the iOS "consumer" on the same phone.

only the "producer" is a B4X app, the "consumer" is based on a different framework, so merging both apps into a single one is not feasible, but both can be modified at will.
I'm currently evaluating options for bidirectional communication between the "producer" and the "consumer".

I expect to be using intents for the "consumer" to launch the "producer", but I have no experience on that nor about using intents for "streaming" data between apps.
Since the topic seems to be very OS-specific, I think there will be 2 different implementation for Android and iOS.

I don't know if local TCP connections can be established between 2 apps: that could be a cross-platform solution, if feasible.
The "producer" should act like a server, listening and answering to the "consumer" requests.

Does anyone have any experience on the topic?
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Run an app in the background is not trivial in Android and even more challenging on iOS.

I'm currently having some success by using UIBackgroundModes bluetooth-central and processing on iOS, since the "producer" app is basically a communication channel with a BLE device.
 
Upvote 0
Top