Ok so to explain I have server in Java that receives data from a C++ program that I have no control over. So the data is transferred over TCP/IP and the Java server just receives it. The volume of incoming data is huge and it comes at a very fast rate, just imagine a terminal printing loads of lines really fast.. I don’t need to get all of it, just as much as I can would be great..
Now I need to send that data to an android device and display it. I have no idea what is the best approach to so this.
I am currently pinging the server from my android device every 50ms using an executor. Then I use a handler to display the data. I have already posted a question with code here: related question.
Obviously the android app will need to ping it while the app is running so I can’t avoid the
I have read about 100000000 ways to do concurrency in Android, and I do not know what to choose for this.
- I tried simple
Threads, they were to hard to manage.
- I am now running a
- I also read about
ScheduledExecutorService, but they need a time duration right ? My app can be running for 5 hours or 5 minutes or 5 years.
- I read about HandlerThreads too, but I am not sure they are ideal for this scenario.
Any help would be great.