×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Brisbane, Australia
    Posts
    41

    Detecting supported configurations

    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
    }
    Using the various Nokia SDKs, this seems to work fine, except on the Nokia 7210 MIDP SDK 1.0, where I get the error "Cannot create class in system package" and the application will not start.

    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

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    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.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Location
    Brisbane, Australia
    Posts
    41
    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

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    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.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Location
    Brisbane, Australia
    Posts
    41
    Originally posted by grahamhughes
    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.)
    Oh.

    Has anyone compiled a list somewhere of which devices do what in this regard?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •