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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 49
Registered: ‎05-20-2009
My Device: Not Specified

GUID

Hi ,

 

Is there any API in BlackBerry that can give GUID or any Globally unique string?.its very Urgent

 

thanks

Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: GUID

In JDE, you can select any string and on right click you will get option to convert this string into long.

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
Developer
Posts: 49
Registered: ‎05-20-2009
My Device: Not Specified

Re: GUID

Hi Deepesh,

 

Perhaps I din't get you right. At run time when I am about to store some data into the local database in the device I would like to generate a GUID which should be globally unique. The generated GUID will be used for the identity coloum in the local database table. It should be globally unique because the local database will have to be synced with the Server database.

 

Thanks

Abees

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: GUID

Check this class in RIM API javadocs:

 

net.rim.device.api.synchronization.UIDGenerator

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: GUID

UIDGenerator will generate the unique one on device, we can't predict the same will not be generated on other device.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: GUID

Combine Device PIN and GUID from UIDGenerator.

 

And this code will be 100% unique.

Highlighted
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: GUID

Just Perfect.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 106
Registered: ‎06-18-2009
My Device: Bold

Re: GUID

I used the UUID implementation found here (version 2.1.5) and changed a few things to make it J2ME compatible. 

 

I replaced the part where he uses the MAC address with the IMEI number and also used UIDGenerator. 

 

Not sure if it is the best solution but I am fairly certain it generates globally unique ids.  I mainly use them because the backend database uses GUIDs and it makes it easy for sync.

 

 

static { String imeiNumber = null; byte[] imeisv = GPRSInfo.getIMEISV(); imeiNumber = GPRSInfo.imeisvToString(imeisv, false); if (imeiNumber != null) { clockSeqAndNode |= Hex.parseLong(imeiNumber); // Uses IMEISV for Mac Address replacement

} else { clockSeqAndNode |= UIDGenerator.makeLUID(UIDGenerator.getUniqueScopingValue(), UIDGenerator.getUID()); // Uses the UIDGenerator for Mac Address replacement } // Skip the clock sequence generation process and use random instead. clockSeqAndNode |= (long) (UIDGenerator.makeLUID(UIDGenerator.getUniqueScopingValue(), UIDGenerator.getUID()) * 0x3FFF) << 48; }

 

----
If this helped you, press the thumbs up button (on the far right - '+' thumb icon)
If this post solved the issue, click "Accept as Solution"
New Member
Posts: 1
Registered: ‎07-21-2011
My Device: blackberry curv
My Carrier: Airtel

Re: GUID

Hi,

 

Can you guide me ... how to generate the UUIDs in J2ME...can you share the code.. classes?

 

Bhaskar

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: GUID

Does this help?

 

javax.bluetooth.UUID