background image
Original Author Paul Laughton, 2011
Page 141
De Re BASIC!
PhoneNumber
String of digits
Phone number registered to this
device, if any
15555215554
DeviceID
String of digits
The unique device ID, such as the IMEI
000000000000000
SIM SN
String of digits or
Not available
Serial number of the SIM card,
if one is present and it is accessible
8901410321111851
0720
SIM MCC/MNC
String of digits or
Not available
The "numeric name" of the provider
of the SIM, if present and accessible
310260
SIM Provider
Name string or
Not available
The name of the provider of the SIM,
if present and accessible
Android
The last six items access your device's telephony system and SIM card. If your device has no telephone,
or BASIC! does not have permission to access them, the fields are set to neutral values: "None", "Not
available", or a string of "0" characters.
In addition, there are convenience commands to retrieve only the Locale or the Language.
The information returned by Device is static. To get dynamic information, use the Phone.Info command.
Device <svar>
Returns information about your Android device in the string variable <svar>. Each item has this form:
key = value
The names key and value refer to the first two columns of the table in the Device overview above. The
items are placed in a single string, separated by newline characters. Formatted this way, if you Print the
string it is displayed with one item on each line. You can separate the individual items with Split:
DEVICE info$
% all info in one string
SPLIT info$[], info$, "
\\n
"
% each array element is one item, "<k> = <v>"
SPLIT lang_line$[], info$[6], " = " % split the Language item, two-element array
lang$ = lang_line$[2]
% lang$ is the language name, like "English"
Device <nexp>|<nvar>
Returns information about your Android device in a Bundle. If you provide a variable that is not a valid
Bundle pointer, the command creates a new Bundle and returns the Bundle pointer in your variable.
Otherwise it writes into the Bundle your variable or expression points to.
The Bundle keys are shown in the first column of the table in the Device overview above.
DEVICE info
% all info in a Bundle
BUNDLE.GET info, "Language", lang$ % lang$ is the language name, like "English"
Device.Language <svar>
Returns the default language of the device as a human-readable string value in string variable <svar>.
This convenience shortcut returns the same value as the "Language" key of the Bundle returned by the
numeric form of the Device command.