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

Web and WebWorks Development

Reply
Contributor
scottmac
Posts: 11
Registered: ‎07-30-2012
My Device: 9900
Accepted Solution

Trying to get Unique ID from Blackberry 10 Phone

I need to retrieve a unique ID from a BB 10 phone.  The phone number would be ideal, but apparently this is not supported in the new version of WebWorks.  I have also tried blackberry.identity.uuid and blackberry.identity.IMEI, both of which work in Ripple, but not on the simulator. 

 

Can anybody tell me how to retrieve a unique ID from a BB 10 phone? 

BlackBerry Development Advisor
bryanhiggins
Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3

Re: Trying to get Unique ID from Blackberry 10 Phone

UUID is what you should use for this purpose. You need the following permit in config.xml

 

<rim:smileytongue:ermit>read_device_identifying_information</rim:smileytongue:ermit>

 

This lets users know that your application may be collecting this information.

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Contributor
scottmac
Posts: 11
Registered: ‎07-30-2012
My Device: 9900

Re: Trying to get Unique ID from Blackberry 10 Phone

I've tried that.  Here is my config and my code, hopefully you can identify what I have done wrong.  This works on Ripple but not in the simulator.  Thanks in advance for the help.

 

Config:

---------

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0.0" rim:header="WebWorks Sample"
 id="TEST">

  <name>Hello World</name>
  <description>This is a sample application.</description>
  <author rim:copyright="Copyright 2013" href="http://somewhere.com">Somewhere</author>
  <icon src="Content/Images/e.png" />
  <rim:splash src="Content/Images/s.png" />

  <content src="Index.html"/>
  <rim:smileytongue:ermit>read_device_identifying_information</rim:smileytongue:ermit>
  <feature id="blackberry.identity"/>
 
  <!--BBUI Stuff-->
  <feature id="blackberry.system.event" />
  <feature id="blackberry.app" />
  <feature id="blackberry.ui.menu"/>
  <feature id="blackberry.ui.contextmenu"/>

</widget>

 

 

Code:

-------

<script type="text/javascript">
         document.addEventListener('webworksready', function (e) {
            bb.init({
                 onscreenready: function (element, id, params) {
             },
                 ondomready: function (element, id, params) {
                     alert("uuid: " + blackberry.identity.uuid);
                     alert("IMEI: " + blackberry.identity.IMEI);
                      
                 }});
             bb.pushScreen('FirstScreen.html', 'firstScreen');
         }, false);
       
     </script>

Contributor
scottmac
Posts: 11
Registered: ‎07-30-2012
My Device: 9900

Re: Trying to get Unique ID from Blackberry 10 Phone

Anybody?  Surely there must be some way to get the phone number or a device ID from this phone.  It was rather simple in our old Java based app.  I am hoping that this is possible and that I am just dong something wrong.

 

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Trying to get Unique ID from Blackberry 10 Phone

You're missing the surrounding tags:

 

<rim:permissions>
<rim:permit>read_device_identifying_information</rim:permit> 
</rim:permissions>

 

Tim Windsor
Open Source Technical Lead
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: Trying to get Unique ID from Blackberry 10 Phone

As Tim says, this definitely works

 

Sorry - lots of cryptography follows

 

blackberry.identity.IMEI is reliable as it is unique to the device, there are other in the blackberry.identity group identifying vectors - uuid is another - but phone number is an inadequte metric (simply change the SIM card)

 

If you want to use anonymous numbers creating a hash from both the uuid and imei makes sense

 

This is relatively easy using the new encryption library extension on GitHub

 

A SHA512 or AES256 is hugly secure (so are the others but key clash is possible on shorter length enctyption)

 

I like SHA512 owing to its remarkable discovery time (10 with 66 zeros years to even run a Rainbow over) while Rainbows of MD5 are widely available for example (bug in the encoding matrix and an 80 bit length)

 

Using your own anonymous ID has its advantages assuming the salt is good enough

 




Click the like button if you find my posts useful!
Contributor
scottmac
Posts: 11
Registered: ‎07-30-2012
My Device: 9900

Re: Trying to get Unique ID from Blackberry 10 Phone

Thank you peardox, this is great information and very similar to what I am ultimately trying to accomplish.