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
Visitor
Posts: 1
Registered: ‎03-06-2012
My Device: 8830
My Carrier: Digitel
Accepted Solution

How could I verify a BlackBerry PIN (DeviceID)?

Hi everyone!

Well, the thing is that I'm developing some private apps requested by a company and they want to restrict its use to just a few users, actually, just a few BlackBerry devices. The client wants to limit the use of this apps to the BlackBerry PIN.

 

I am trying to validate something like:

 

(Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase() == 2100000A)

but it is always false.

 

I have tried without "toUpperCase()", with 2100000a and even without any conversion writing decimal numbers, just using DeviceInfo.getDeviceID() and decimal ID.

 

I have tried not using the simulators but a BlackBerry device but I get the same result, that validation is always false.

 

Am I trying to do something that is not possible? Thanks in advance for your help.

 

Developer
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: How could I verify a BlackBerry PIN (DeviceID)?

[ Edited ]

Try to validate like this:

 

if("2100000A".equalsIgnoreCase(Integer.toHexString(DeviceInfo.getDeviceId())))
{
	System.out.println(Integer.toHexString(DeviceInfo.getDeviceId()));//TRUE;
}
=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How could I verify a BlackBerry PIN (DeviceID)?

welcome to the support forums.

alishaik786 is correct, you should compare objects using equals.
'==' is an identity check (same object).
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How could I verify a BlackBerry PIN (DeviceID)?

and perhaps:

 

DeviceInfo.getDeviceId() == 0x2100000A

 

is an easier test anyway?

 

Have you looked at

 

DeviceInfo.isSimulator()

 

Not all SImulators run with the PIN 2100000A.