coronanet / rn-coronanet

React native interface of the Corona Network
12 stars 4 forks source link

Long running background service + internet access #3

Closed karalabe closed 4 years ago

karalabe commented 4 years ago

Continuation of https://twitter.com/peter_szilagyi/status/1239827659275866114

If we want to go down the decentralized path, that means a constantly chattering background service. I am aware that a DHT is out of the question (too much traffic, too much shuffling, UDP blocked, etc), but the current plan of comms via Tor should be doable, since it would basically be idle TCP connections unless there's something meaningful to transfer.

Either way, to get back to the question at hand, such a P2P service would need to run both when the application is in the foreground, as well as when it's in the background (or has no activities). The latter is especially tricky because Android likes to do everything in its power to avoid you doing that (parental control much?).

This issue is a blocker for the feasibility of the whole application, since we must be able to communicate with the world at will.


If my understanding of Android is correct, we're aiming for a Foreground Service here. The tricky part is that it also needs to show a constant notification to the user, which I've no idea how to do in react (of whether we'd need to dive into native code for it).

karalabe commented 4 years ago

I've found this library that does something eerily similar to what we'd need here (haven't yet tried it out): https://github.com/voximplant/react-native-foreground-service. The project itself as a whole is not useful, because it allows creating .js forground services, but the implementation itself might be exactly what we need. Will dig into it a bit later.