Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
New Developer
Posts: 3
Registered: ‎06-23-2009
My Device: Not Specified
Accepted Solution

ESN returned by CDMAInfo is different from the one displayed on Status screen

Hi,

 

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?

 

Thanks.

 

Denis

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

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');

 

 

 

New Developer
Posts: 3
Registered: ‎06-23-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

Thanks, this solved the problem.
Developer
Posts: 148
Registered: ‎11-16-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

Hi,

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)

thx

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

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"

 

 

Developer
Posts: 148
Registered: ‎11-16-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

ok

thank you for your quick response.

have a nice weekend

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: ESN returned by CDMAInfo is different from the one displayed on Status screen

You're welcome!