Handyspezifische Applikationen entwerfen
Is there an easy way of identifying the device, that my midlet
is running on. ie. Am I running on a siemens, or nokia etc?
And a related question:
Is there any way of writing a midlet so that it can use siemens
specific api calls on a siemens phone, and have those same
calls ignored (and not crash the midlet) when it is run on
a nokia device?
> I've tried:
>
> try {
> com.siemens.mp..... etc
> } catch( Exception e ) {}
>
> and it crashes at startup (on the sun kvm emulator, and
6310i
> emulator).
>
> Any ideas?
Lösung
- pack your phone specific code in a single class (or more
classes when targeting multiple phones)
- write several jad-files (jar file can be the same) and use
a custom property that describes the phone
- use getapp property to query that property and use class.forname
to load your phone-specific class
I did not find a common way to determine the phone type. Maybe
system.getProperty("com.siemens.IMEI") can be used
to detect a siemens phone.
|