I have an app that connects to the Bitmessage network, i.e. is downloading and processing data from the P2P network all the time. Also, it should (optionally) only use WiFi/unmetered networks.
I've implemented this by using the JobScheduler, but unfortunately it has a timeout of 10 minutes (apparently even 1 minute on Lollipop).
So in short, how do I implement a service that
- automatically starts when WiFi is available
- automatically disconnects when a metered network is used
- doesn't time out
- works on all Android versions since Lollipop