问题
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