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

Android™ Runtime Development

Reply
New Contributor
Kevin_Wilson
Posts: 2
Registered: ‎02-29-2012
My Device: Blackberry Playbook
My Carrier: Airtel
Accepted Solution

Unique Device ID for Blackberry Playbook

    My android app, which I am trying to port on playbook, requirs an unique device id to identify each installation. On android I use device's IMEI as uniqe id. I can get this using following code

 

TelephonyManager mTelephonyMgr = (TelephonyManager) app_context.getSystemService(Context.TELEPHONY_SERVICE);

String imei = mTelephonyMgr.getDeviceId();

 Same code on playbook simulator returned me 0000000000429496681245 as IMEI of device. Now I am not sure what this number is and will it be unique?

 

AFAIK blackberry devices has a PIN as unique id.

 

Is there a way to access PIN of device using androud code?

 

Please help....

 

Thanks in advance...

Please use plain text.
Developer
bec0ding
Posts: 55
Registered: ‎01-25-2012
My Device: BlackBerry Torch 9800 & PlayBook

Re: Unique Device ID for Blackberry Playbook

[ Edited ]

Nope, there is no way to get the PIN ... RIM really needs to do something about this ...


EDIT : I'm working on a way to get it ... Just waiting to receive my PB to test it ...

Please use plain text.
Developer
bec0ding
Posts: 55
Registered: ‎01-25-2012
My Device: BlackBerry Torch 9800 & PlayBook

Re: Unique Device ID for Blackberry Playbook

[ Edited ]

Well turns out it contains the PIN in decimal format.

 

		TelephonyManager tm = (TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE);
		
		String strDevice = tm.getDeviceId();
		
		String strPIN = strDevice.substring(10, strDevice .length() - 2);

 

Please use plain text.
New Contributor
Kevin_Wilson
Posts: 2
Registered: ‎02-29-2012
My Device: Blackberry Playbook
My Carrier: Airtel

Re: Unique Device ID for Blackberry Playbook

[ Edited ]

Yes. You are right.

 

We can also get exact PIN :smileyhappy:

 

                TelephonyManager tm = (TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE);
		
		String strDevice = tm.getDeviceId();
		
		String strPIN = strDevice.substring(10, strDevice .length() - 2);

                strPIN = Long.toHexString(Long.parseLong(strPIN ));

 Thanks

Please use plain text.
New Contributor
bigluc
Posts: 7
Registered: ‎03-17-2012
My Device: Playbook Soon!
My Carrier: ATT

Re: Unique Device ID for Blackberry Playbook

Is there any way to get the 16 digit device ID?
Please use plain text.
New Contributor
bigluc
Posts: 7
Registered: ‎03-17-2012
My Device: Playbook Soon!
My Carrier: ATT

Re: Unique Device ID for Blackberry Playbook

Solved!

String deviceId = Settings.System.getString(getContentResolver(), Settings.System.ANDROID_ID);
Please use plain text.
Visitor
Rossovich
Posts: 1
Registered: ‎07-28-2012
My Device: playbook
My Carrier: Tbaytel

Re: Unique Device ID for Blackberry Playbook

Where do I type this to get the ID?
Please use plain text.