| Reply | « Previous Thread | Next Thread » |
|
Hi,
I am trying to write some generic sound code that adapts itself to the capabilities of the phone on which it is running. For example, I have the following code: Code:
try {
Class c = Class.forName("javax.microedition.media.Player");
// . . . MMAPI is supported
} catch (ClassNotFoundException cnfe) {
// . . . no MMAPI, fall back on NokiaUI Sound lib
}
Does anyone know if the failure is just a problem with this SDK (and possibly others), or does it also occur on the phone in question? If the problem is also on the phone, is there another way to test for API support (i.e. presence of MM API) that works? Thanks, Gabriel |
|
This is a bug in early Nokia Series 40 devices. They fail on forName where the class begins with "java.", "javax.", "com.sun." or "com.nokia.". Unfortunately, this makes it impossible to detect APIs correctly on these devices.
Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Hi Graham,
Thanks for the reply. So, basically I take it that I can use this method safely on anything but Nokia Series 40 dev platform 1.0 devices? Regards, Gabriel |
|
If I remember right, it even works on most Series 40s, just not the earlier 7210s.
I should say, you may find it difficult to create a single build for more than a handful of devices, unless your application does not stretch things too far (and, having sound comes under the heading of "stretching"!). Even phones with MMA tend to be inconsistent in their implementation. (On some phones you must deallocate the sound after playing, or other sounds won't play; on others you must not deallocate it, or it won't play again; on others, you must trash the player instance and re-create it each time.) Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Quote:
Has anyone compiled a list somewhere of which devices do what in this regard? |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|