| ID | ... | Creation date | June 26, 2009 |
| Platform | S60 3rd Edition, FP1, FP2 S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic, Nokia 6720 classic |
| Category | Qt for Symbian | Subcategory |
| Keywords (APIs, classes, methods, functions): XQSysInfo::mcc(), XQSysInfo::mnc() |
This code snippets shows how to get MCC and MNC from device in Qt. Basically IMSI is 15 digits long number. The first 3 digits of IMSI are the MCC, and is followed by the MNC, either 2 digits (European standard) or 3 digits (North American standard). So retriving MCC and MNC from IMSI is not always safe, thus implemented this method to get MCC MNC from CTelephony::GetCurrentNetworkInfo() API of symbian.
This snippet requires ReadDeviceData capabilities. Self-signing is not possible because a Developer certificate is needed.
Note: These files are extended from source file of XQSysInfo API. More clearly , i have just edited some file of XQSysInfo API to get MCC and MNC. XQSysInfo::mcc() return MCC and XQSysInfo::mnc() return MNC.
#include <XQSysInfo>
All source files are automatically added to .pro file by carbide, so need to add the libraries and capability only.
symbian:LIBS += -letel3rdparty \
-lsysutil \
-lefsrv \
-lfeatdiscovery
symbian:TARGET.CAPABILITY = ReadDeviceData
XQSysInfo *sysInfo = new XQSysInfo(this);
/* show MCC on label */
ui.label->setText("MCC: " + sysInfo->mcc());
/* show MNC on label */
ui.label_2->setText("MNC: " + sysInfo->mnc());
The code snippet is expected to show MCC MNC on screen as showm bellow.