09-01-2009 08:58 AM
I am developing an application which runs on BB and needs to check with the internet server whether it is registered. We've been using IMEI for GSM networks, and ESN for CDMA to uniquely identify the device. When users buy the application, they register the phone on the internet by providing either IMEI or ESN, download the application, and then the application verifies the registration. It all worked fine on many older devices, including CDMA ones, until we tested it on 9530 (Storm).
The problem is that ESN reported by the API CDMAInfo.getESN() is different from the one which user sees on their screen Options/Status. Consequent to that, when the user manually registers over the internet, the ESN reported by the mobile device mismatches and verification of registration fails on the mobile device.
I've been trying to figure out why these ESNs are different. Even on simulator, if I specify ESN as one of the parameters for simulator, the status screen displays different number. It seems to be a function of ESN, because the number changes depending on which ESN I specified.
Any insight of what function it might be? Why is it different? Is there any other number that we can use to uniquely identify the mobile user on the internet?
Solved! Go to Solution.
09-01-2009 10:22 AM
How about you give us couple of ESN pairs (getESN API vs Status screen) as an example?
Also, try formatting the ESN returned by CDMAInfo.getESN() like this:
int esn = CDMAInfo.getESN(); int firstPart = (esn >>> 24) & 0xFF; int secondPart = esn & 0xFFFFFF; return leftPad(String.valueOf(firstPart), 3, '0') + leftPad(String.valueOf(secondPart), 8, '0');
06-18-2010 04:19 AM
can you tell me what is do the leftPad method ? (i don`t find in the JDE so i guess i must implement it, but i don`t know what do that method)
06-18-2010 07:36 AM
leftPad in the above example prepends a number of '0' characters to its argument to make the resulting string as long as requested. For example,
leftPad("1", 3, '0') -> "001" leftPad("12", 3, '0') -> "012" leftPad(1234, 3, '0') -> "1234"