Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve physical info of a cellphone?

 
Lester Fernandez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I'm newbie in J2ME. Is there any way to retrieve cellphone's physical info such as processor used, RAM size, or screen resolution in Java?

Thx
[ December 09, 2004: Message edited by: Lester Fernandez ]
 
William Frantz
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lester Fernandez:
Is there any way to retrieve cellphone's physical info such as processor used, RAM size, or screen resolution in Java?

That depends. Which phone/carrier are you asking about?

Sprint publishes very detailed information about each of their handsets. Here's an example for my phone:
http://device.sprintpcs.com/LG/PM325/PM325V16.rdf

All Sprint phones will send the URL to the corresponding RDF file as part of the HTTP header information. A server could process that and return data back to a J2ME application.

William Frantz
http://sprintdevelopers.com
 
Lester Fernandez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
Thx for your answer but I think it'll only work for Sprint's cellphones, isn't it? ;-)

Can't we ascess the system file of a cellphone (whathever its OS) to via J2ME?


Originally posted by William Frantz:

That depends. Which phone/carrier are you asking about?

Sprint publishes very detailed information about each of their handsets. Here's an example for my phone:
http://device.sprintpcs.com/LG/PM325/PM325V16.rdf

All Sprint phones will send the URL to the corresponding RDF file as part of the HTTP header information. A server could process that and return data back to a J2ME application.

William Frantz
http://sprintdevelopers.com


 
William Frantz
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

William Frantz
http://sprintdevelopers.com
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
arnel nicolas
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

arnel
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic