Get formatted SIM card number on BlackBerry

2019-08-09 06:39发布

In my application I need to get the SIM card number. I am getting that with SIMCardInfo.getIMSI(), but in some other format.

My SIM number is 89919400002018929130, but I am getting: 404940.20.189291.3

I used the following code:

   try 
    {
       currentSimNo = GPRSInfo.imeiToString(SIMCardInfo.getIMSI());
    } 
    catch (Exception e) 
    {

    }

2条回答
SAY GOODBYE
2楼-- · 2019-08-09 06:58

sampath says:

My SIM number is 89919400002018929130, but I am getting: 404940.20.189291.3

If I line up your two numbers and remove separators, it does look like they are roughly the same:

89919400002018929130
    404940201892913

Where did you get the first one from?

In the Wikipedia article on IMSI, you can see that the first three digits are the MCC, then the second three are the MNC. So it looks like your SIM is from India, though I don't see a MNC that matches 940.

These values are frequently encoded as binary-coded decimal, which is why the imeiToString method needs to be used.

EDIT

The IMSI wikipedia article also mentions:

An IMSI is usually presented as a 15 digit long number, but can be shorter.

I think your code is returning the correct value as 404940201892913. Whatever number you are trying to compare it to (899194...) must be encoded differently.

查看更多
三岁会撩人
3楼-- · 2019-08-09 07:00

The imeiToString takes a IMEI not a IMSI

查看更多
登录 后发表回答