Java Reference
In-Depth Information
FileConnection fc = (FileConnection)
Connector.open(mp3Path, Connector.READ);
InputStream is = fc.openInputStream();
player = Manager.createPlayer(is, "audio/amr");
player.realize();
volumeControl = (VolumeControl) player.getControl("VolumeControl");
if (volumeControl != null) {
volumeControl.setLevel(100);
} player.prefetch();
player.start();
To enrich our application with more advanced capabilities, we could
also use JSR-234 Advanced Multimedia Supplements, which extends JSR-
135 MMAPI and defines support for advanced multimedia functionality.
For example, MusicMate could use the EqualizerControl which is
an audio EffectControl and can be used to tune the sound. Two
other examples for JSR-234 supplements are 3D audio support and audio
radio support.
JSR-135 is a mandatory Component JSR in both full MSA and MSA
Subset; JSR-234 is a Component JSR in full MSA only. That might not
be a limitation, since good planning should include identifying the
target audience and the types of device they have. That task should be
completed before the coding begins and prevent you from using features
that are not available on the target device (see Section 4.4).
This is sufficient to let us play tracks that are already on the user's
phone but it's not enough for our trendy and cool MusicMate. We'll
throw in JSR-172 Web Services, which provides a standard Java ME API
to support web services and XML parsing. MusicMate uses it to let the
user search for existing content in websites. The user types in the search
criteria and MusicMate sends the query to the portal and displays the
content that is available for purchase (with your business partner you
need to agree on how to expose the web service at the server end).
MusicMate can send tracks to friends using a short-link connection,
such as JSR-82 Bluetooth. Internationalization can be managed using
JSR-238, which defines a common API that enables you to isolate local-
izable resources from the application source code and to access those
resources at run time. It also provides support for a user-selected or
device-selected locale, recognizing cultural conventions, such as date
and time formats. The importance and benefit for developers of JSR-238
Internationalization is tremendous when you consider that mobile appli-
cations tend to be used in many countries by people who speak many
different languages.
The following snippet gets a localized string and image, using the
javax.microedition.global.ResourceManager class:
 
Search WWH ::




Custom Search