Well ...
You could start with one already written for some other operating system, to see how it's done. (Not how programming is done, how GPRS p2p is done.)
Then you could write the same thing for Android.
That's basically how you write any program. The "writing" part is "you do this first, then you do that. If this happens, do that, otherwise do the other. Etc."
The rest is just coding the program into a programming language - that's the easy part.