Originally posted by Lester Fernandez: Can't we ascess the system file of a cellphone (whathever its OS) to via J2ME?
Again, it depends on the phone/carrier, but in general no.
There is no standard method for accessing a file system from MIDP 1.0. Even if there was, there would be no standard file that would contain the device ID information you are looking for.
J2ME only offers the Record Management System (RMS) for persistant storage of data. Each application has its own RMS. It's very difficult to share data between different MIDlets let alone native applications on the phone.
You can call Runtime.totalMemory() to see the total RAM available on that device. With Runtime.freeMemory() you can see how much is free right now.
You can create a Canvas object and call its getWidth() and getHeight() to see what is the maximum screen width and height availble to the MIDlet. Actually in MIDP 2 those methods are available to any descendant of Displayable, but if you want to support MIDP 1 use Canvas.
I don't know of a method that can tell you the processor type. I think you can make a small benchmark routine that you can call in a separate thread to measure the performance of the device. [ January 13, 2005: Message edited by: Yuri Magrisso ]
Correct me if i am wrong, but calling Runtime.getTotalMemory() returns the total amount of memory in the Virtual Machine. Does it mean this is also the physical size of the device's memory? From the API it says that this method maybe implementation-dependent so it means it may vary from different devices.
posted 13 years ago
You are right - according to spec Runtime.totalMemory() returns the memory available to the JVM. I suppose that depending on the device this can be all its RAM or less.
It will be interesting though to check on the different devices how the listed RAM of the device differs from what Runtime.totalMemory() reports.
If I am not mistaken Motorola lists only the RAM available to the JVM.
It probably depends whether the device is a smart-phone / PDA or a phone that has only a Java Runtime. For devices that have only Java Runtime it makes sense to list only the memory available to Java. On devices that give access to its OS the total RAM and the RAM available to the Java Runtime may be different.
Anyway, for J2ME development we can anyway use only the memory available to the Java Runtime, so Runtime.totalMemroy() should be enough. [ January 15, 2005: Message edited by: Yuri Magrisso ]