Difference between revisions of "Mojo Identify Device"

From WebOS Internals
Jump to navigation Jump to search
(create)
 
m (Mojo.Environment.DeviceInfo is a variable (constant?), not a function. Fixed that...)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
To tell if you are running on a Pre or a Pixie or some other future WebOS device use this call:   
+
To tell if you are running on a Pre or a Pixie or some other future WebOS device use this variable:   
  
 
+
  ''Mojo.Environment.DeviceInfo''  
''Mojo.Environment.DeviceInfo''  
 
  
 
It should give you back an object something along the lines of this:
 
It should give you back an object something along the lines of this:
  
 
<pre>{ "modelName": "Pr?",  
 
<pre>{ "modelName": "Pr?",  
"platformVersion": "1.0.2",  
+
"modelNameAscii": "Pre",
 +
"platformVersion": "1.3.1",
 +
"platformVersionMajor": 1,
 +
"platformVersionMinor": 3,
 +
"platformVersionDot": 1,
 
"carrierName": "Sprint",  
 
"carrierName": "Sprint",  
 
"serialNumber": "Unknown",  
 
"serialNumber": "Unknown",  
Line 17: Line 20:
 
"maximumCardHeight": 424,  
 
"maximumCardHeight": 424,  
 
"keyboardAvailable": true,  
 
"keyboardAvailable": true,  
 +
"touchableRows": 8,
 +
"keyboardAvailable": true
 
"keyboardSlider": true,  
 
"keyboardSlider": true,  
 
"keyboardType": "QWERTY",  
 
"keyboardType": "QWERTY",  
 
"wifiAvailable": true,  
 
"wifiAvailable": true,  
"bluetoothAvailable": true }
+
"bluetoothAvailable": true,
 +
"coreNaviButton": true }
 +
</pre>
 +
 
 +
The documented values (as of 2009/12/10) are
 +
<pre>{"screenWidth": INT (px),
 +
    "screenHeight": INT (px),
 +
    "minimumCardWidth": INT (px),
 +
    "minimumCardHeight": INT (px),
 +
    "maximumCardWidth": INT (px),
 +
    "maximumCardHeight": INT (px),
 +
    "keyboardType": STRING,
 +
    "touchableRows": INT}
 +
</pre>
 +
I would guess that the other fields probably won't go away or change in weird ways, but one can't be certain.
 +
 
 +
 
 +
Mojo.Environment.build holds a number like 200.47 (for a Sprint Pre, 1.3.1).

Latest revision as of 00:00, 15 February 2011

To tell if you are running on a Pre or a Pixie or some other future WebOS device use this variable:

 Mojo.Environment.DeviceInfo 

It should give you back an object something along the lines of this:

{ "modelName": "Pr?", 
"modelNameAscii": "Pre",
"platformVersion": "1.3.1", 
"platformVersionMajor": 1,
"platformVersionMinor": 3,
"platformVersionDot": 1,
"carrierName": "Sprint", 
"serialNumber": "Unknown", 
"screenWidth": 320, 
"screenHeight": 480, 
"minimumCardWidth": 320, 
"minimumCardHeight": 188, 
"maximumCardWidth": 320, 
"maximumCardHeight": 424, 
"keyboardAvailable": true, 
"touchableRows": 8,
"keyboardAvailable": true
"keyboardSlider": true, 
"keyboardType": "QWERTY", 
"wifiAvailable": true, 
"bluetoothAvailable": true,
"coreNaviButton": true }

The documented values (as of 2009/12/10) are

{"screenWidth": INT (px), 
    "screenHeight": INT (px), 
    "minimumCardWidth": INT (px), 
    "minimumCardHeight": INT (px), 
    "maximumCardWidth": INT (px), 
    "maximumCardHeight": INT (px), 
    "keyboardType": STRING, 
    "touchableRows": INT} 

I would guess that the other fields probably won't go away or change in weird ways, but one can't be certain.


Mojo.Environment.build holds a number like 200.47 (for a Sprint Pre, 1.3.1).