This week I continued working on the
Android randomness collection.
Networking:
First, I wrote a simple server program
using Java sockets to accept and print any incoming communication. I
then wrote a corresponding client program and ran both on the same
machine. After I got this working, I verified that they also worked
on separate machines. With this working, I modified the client
program for Android and ran it on the Nexus S. This process mainly
involved creating a new thread to do the network communication since
Android does not allow this from the UI thread. This allowed me to
get working communication between the Android phone and a server.
Next, I wrote the final server program.
The networking is very similar to the previous program, but I
modified the structure to spawn a new thread for every client. I then
wrote synchronized methods to separate the messages based on type
(wifi, bluetooth, antenna) and write them to files local to the
server.
Android Services:
As stated in my previous post, I want
to alter my existing Android code to use services so that the user
doesn't have to leave the collection app open for it to do its job.
Therefore, I did some research on services and the code needed to
implement them. I followed instructions I have found online, and have
modified the previous bluetooth program to use a service. At present,
I am debugging this since the service doesn't ever seem to start. I
am confident however, that I will resolve this quickly, and that once
I do, the other two parts will be easy to finish.