Search code examples
androidbrowserplotadb

Getting data from android device and plot in browser


I am trying to get data from app running on android device and plot it in a browser running on PC.

I considered below methods

Method 1

  1. Write data from android app to cirular files[ file1.txt -> file2.txt -> file3.txt -> file1.txt ] at regular intervals, in my case 1 sec.
  2. Pull the files using adb in circular order.
  3. Again use the same circular order in reading files in browser using XMLHttpRequest and plot using some javascript.

Here I am facing some error while reading the file using XMLHttpRequest, there may be a issue of synchronisation -> reading and writing of the files.

I think this is very naive approach.

Method 2

I considered one more option of using USB tethering to establish a TCP connection between device and PC and get data from the APP from client-socket running on PC. ( This method sounds better than writing data into files in the device and pulling files using adb ).

Still unable to find a way to send the data received from device to browser for plotting.

Constraints

I am not allowed to use any kind of webserver on the device side.

Any method I think of has some kind of ping-pong/circular approach somewhere in the process, which I think is not a good option.

I know this sounds like pretty simple problem to many of you.

It will be of great help, if anybody gives some elegant approach.


Solution

  • I could able to find answer in some form.

    1. Open TCP/UDP connection from the app running on Device to PC to which it is connected (using USB) and send data.

    2. a) If data has to be processed, process that data in another application and send the processed data to node.js running on PC b) If there is no processing required directly send data from Device to node.js

    3. Open websocket in node.js and send that data to browser running on another PC.