From time to time, I receive questions about how to port peers to non-standard java environments (android, blackberry, etc.).
As I receive this question quite often, I post this article here, it may help people willing to use non-J2SE virtual machines.
Peers uses generics, which came with java 5. It means that you have to rewrite all classes using generics if you want to run peers on a java 1.4 JVM.
In peers source code, annotations are not extensively used. You will only find basic @Override. You will find more complicated annotations in test/ folder, but as its name implies those annotations are just used for tests. Those annotations correspond to testng annotations. Testng is the test framework employed in peers.
As you can see, if you want to port peers to a standard java 1.4 environement, it may be long, but not complicated.
It may be more complicated when you want to port peers to an environment where all J2SE packages are not available.
In this case, you have to find the differences between the java APIs provided by your environment and J2SE.
Generally, the critical point to write a voip application for a mobile phone is microphone access. In mobile environments, there may be manufacturer-specific java APIs or java wrappers for custom native APIs.
There are at most three APIs for mobile phones that differ from standard PC JRE:
- sound playback/sound capture,
Peers uses standard DatagramSocket and DatagramPackets for networking. As GUI is the first thing that is demonstrated on mobile phones when new software development kits are released, comprehensive tutorials are generally provided. Peers uses swing for GUI, and swing is generally not provided in exotic environments, so you have to consider it seriously. As already said, the most complicated will probably be on microphone access, as mobile phone providers often restrict access to microphone in development environments. But as always, it’s worth a try!