Get formatted SIM card number on BlackBerry

主宰稳场 提交于 2019-12-11 06:28:48

问题


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) 
    {

    }

回答1:


The imeiToString takes a IMEI not a IMSI




回答2:


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.



来源:https://stackoverflow.com/questions/4429885/get-formatted-sim-card-number-on-blackberry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!