首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> Network >> 正文
How to retrive the IMSI number
作者:佚名    文章来源:不详    更新时间:2006-5-7 11:18:25

IMSI is an abbreviation for "International Mobile Subscriber Identity". The IMSI number is a unique 15-digit code that is attached to every SIM (Subscriber Identification Module) card and makes it possible for mobile networks to identify the home country and network of a subscriber.

UIQ platform

The IMSI number can be obtained from Sony Ericsson P800 and P900 smartphones for use in C++ applications by reading the contents of the file C:\System\data\imsi.txt

This file will be updated automatically if the SIM card is changed.

Some system processes keep this file open and therefore the file needs to be opened in shared mode for readers. This is done by using the EFileShareReadersOnly flag when opening the file. The following C++ code reads the contents of imsi.txt and displays it on the screen:


RFs fs;
fs.Connect();
RFile file;

_LIT(KImsiFileName,"C:\\System\\data\\imsi.txt");

TInt res = file.Open(fs,KImsiFileName,
 EFileShareReadersOnly|EFileStreamText);

if(res != KErrNone)
{
 gConsole->Printf(_L("Open failed: %d\n"),res);
}
else
{
 TBuf8<128> buf;
 file.Read(buf);
 file.Close();
 fs.Close();

 TBuf<128> printBuf;
 printBuf.Copy(buf);
 gConsole->Printf(_L("IMSI: "));
 gConsole->Printf(printBuf);  
 gConsole->Printf(_L("\n"));
}

Series 60 Platform

On the Series 60 platform, the same is possible for the phones that support the 3rd Party Telephony API (this means phones based on v7.0s except the Nokia 6600).

The IMSI can be obtained using the following code:

CTelephony telephony = CTelephony::NewL();
TRequestStatus status;
CTelephony::TSubscriberIdV1 subscriberId;
CTelephony::TSubscriberIdV1Pckg subscriberIdPckg(subscriberId);
telephony->GetSubscriberId(status, subscriberIdPckg));
User::WaitForRequest(status);
User::LeaveIfError(status);
TPtrC theIMSI(subscriberId.iSubscriberId);


This tip was originally posted on SonyEricsson Developer Site for the UIQ version and on Symbian site for the Series 60 one
相关文章:
How to reset the alternate makmake entry in Codewarrior
Retrieving IMEI, IMSI, Network Info (Cell Id, Location Code) on 3rd Edition.
Carbide.vs - Disabling the MMP/PKG File update feature
Codewarrior: how to avoid the "Too Many Include Paths" error when using the UIQ 2.1 SDK
Carbide.c++: Setting up On Target Debugging
Display the extended panic code in Emulator or Device
Start automatically an application or an exe after its installation
Compress Your Symbian C++ Executables
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号