Browser Javascript library

The Browser class provides access to Browser level characteristics to functionality, like terminal size, debug output, cookies.

int getWidth ():
Returns the screen width

int getHeight ():
Returns the screen height

void print (String message):
Display message in the console

void exit ():
Quit the player

void setCooky (String s1, String s2):
Set an association between s1 and s2 in a temporary storage area (cleared at player exit)

String getCooky (String s):
Returns the string associated with s.

String getIntCooky (String s):
Same as getCooky but return the integer stored in the cooky string

int getNbMimeTypes ():
Returns the number of MIME types supported by this JME platform.

String getMimeType (int i):
Returns the MIME type at index i in the list of supported types.

int getFps ():
Returns the number of rendered frames per second

int getIdle ():
Returns the percentage of available CPU

void vibrate (float duration):
Make the phone vibrate for duration seconds (A value of zero should stop vibrations)

String setRecord (String s1, String s2):
Associate permanently the value s2 to the key s1 (persistent across sessions)

String getRecord (String s):
Returns the permanent cooky associated with s

void deleteRecord (String s):
Delete the persistent record matching the s string.

void deleteAllRecords ():
Delete all the persistent records.

boolean hasRecord (String record):
Return true if record exists.

String getVersion ():
Returns the current version of the player.
Ex: 1.0b4 for 1.0 beta 4, 1.0rc2 for 1.0 release candidate 2, 1.0 for final released version (so next one will be at least 1.1).

int getSessionTraffic ():
Returns the HTTP traffic since startup of the application

int getTotalTraffic ():
Returns the HTTP traffic since MIDlet deployment or last reset.

void resetTraffic ():
Resets the total and session HTTP traffic counters

void sendMessage (String messageURL, String data1, ..., String dataN):
Send multiple strings message to Message nodes matching messageURL.

void displayTextBox (String title, String text, int maxLength, int type, String okLabel, String cancelLabel, [...]):
Displays a native TextBox using the mobile phone's UI. This allows using T9 input. title is the title of the native page displaying textbox. text is the text that should already be set into the textbox at initialization.
For type, see TextField documentation (default = 0 / numeric = 2 / password = 65536 ...).
okLabel and cancelLabel will be set as softkeys of the native window. You can set an additionnal parameter to have a callback function when textbox is cancelled.

void displayAlert (String title, String text):
Displays a native Alert using the mobile phone's UI.

String getJadProperty (String key):
Returns the JAD property associated to key.

String getProperty (String key):
Returns the system property associated to key. More informations...

void setTimeout (Function callback, int time, [args...]):
Set a timer to call back a function with optional comma-separated arguments after a given time (in milliseconds).

void deleteStore (String storename):
Delete all records of a given store.

void setStore (String storename):
Use another place to store the records of setRecord/getRecord.

String getCountryCode ():
Returns the two letters country code based on the SMS-C information.

String getLanguage ():
Returns the two letters language used by the phone interface.

int getFreeMemory ():
Returns the avaiable memory.

int getTotalMemory ():
Returns the total memory. This value can changed dynamicaly on some phones.
The garbage collector each time this function is called. Use carefully.

boolean forceBacklight (boolean force):
Force the backlight on when force is true. Returns true if forcing backlight on is supported.


Message Example

See Message node for an example.


Cookies Example


Records Example