This post originated from an RSS feed registered with Java Buzz
by Fred Grott.
Original Post: MISP1.0+Closed APIS
Feed Title: ShareMe Technologies-The Mobile Future
Feed URL: http://sedoparking.com/search/registrar.php?domain=®istrar=sedopark
Feed Description: A Weblog about Java programming and digital convergence on mobile devices in such areas as P2P and collaborative technology. Old Archive .
You maybe wondering how to keep your core MIDP1.0 code straight when for
some handset ports you will be using closed apis. What you may want use is
wrapper classes to call specific closed apis cllaswith abstract calls for
doing shakes, making sounds, enabling png transparency, scaling an image
to screen size, and etc.
To do the correct class/method call you
woudl use the microedition.platform string which has both the handset
vendor and device name separated by a space. Your call of class and
methods would then depend upon this naming style of:
com.yourCompanyName.midp.handsetVendor
You would then use the
deviceName to choose between handset series closed api calls within the
wrapper classes. Thus, you would have two dependencies in doing series
Nokia 40 handsets; the closed apis for that series and the Nokia wrapper
class. But the main thing is you are not changing your main MIDP1.0 core
code.
Yes it does mean an extra amount of code in your global class
file, Cache, some booleans for sounds, shakes, png transparency, png
scaling, and etc. Then some if statements based on these booleans spread
throughout the game. But then you get code that is easily maintained and
portable with the benefit of only including code needed and class
libraries that are needed fro that handset series.