• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Identifying the device type in MIDlets

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to find out a device type/model/name on which my MIDLet is running. For E.g. BlackBerry or PalmOS etc. Is there any way of doing it ?
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Varsha,
There is one way of doing this. Add a functionality to your MIdlet to perform a HTTP Request to the server(HTTP Get or POST). HTTP Header - User Agent Field will contain the Model and Make of the Device.This can be trapped by the receiver servlet / JSP. If the device supports UAProf then it will contain other capabilities information also.
Rgds
Muthu
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be able to find out the device type by calling in your MIDlet. Most devices will return a String describing the device (e.g. my Nokia 7210 returns "Nokia7210/4.20").
Unfortunately, not all devices implement this properly - some just return null, others just return "j2me". I don't know about Palm or Blackberry.
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Price:
You should be able to find out the device type by calling in your MIDlet. Most devices will return a String describing the device (e.g. my Nokia 7210 returns "Nokia7210/4.20").
Unfortunately, not all devices implement this properly - some just return null, others just return "j2me". I don't know about Palm or Blackberry.


David what devices don't implement this? I though all MIDP1.0 compliant devices had to implement this ?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Motorola and Sony Ericsson phones return null for microedition.platform. Sanyo, Samsung, LG, and MIDP4Palm all return "j2me".
Most phones do not set a User-Agent header with MIDP HttpConnections, so you can't rely on that either.
When I've needed to identify the device, I've used a combination of microedition.platform, the canvas size, and the number of display colours. Unfortunately, it involves some guesswork and isn't very robust, but I've found it satisfactory for my needs.
 
varsha gaware
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
thanks for your replies..
Finally I did something like this, which returns true on plam and false on blackberry ..
boolean bIsPalm;
Class.forName("com.sun.midp.palm.Info");
bIsPalm = true;
Thanks,
varsha
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic