06-25-2009 07:14 AM
Hi ,
Is there any API in BlackBerry that can give GUID or any Globally unique string?.its very Urgent
thanks
06-25-2009 07:19 AM
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".
06-25-2009 07:40 AM
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
06-25-2009 09:31 AM
Check this class in RIM API javadocs:
net.rim.device.api.synchronization.UIDGenerator
06-26-2009 02:32 AM
06-26-2009 02:50 AM
Combine Device PIN and GUID from UIDGenerator.
And this code will be 100% unique.
06-26-2009 03:09 AM
06-26-2009 12:54 PM
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.getUniqueScopin
gValue(), UIDGenerator.getUID()); // Uses the UIDGenerator for Mac Address replacement } // Skip the clock sequence generation process and use random instead. clockSeqAndNode |= (long) (UIDGenerator.makeLUID(UIDGenerator.getUniqueScopi ngValue(), UIDGenerator.getUID()) * 0x3FFF) << 48; }
07-21-2011 12:54 AM
Hi,
Can you guide me ... how to generate the UUIDs in J2ME...can you share the code.. classes?
Bhaskar
07-21-2011 05:39 AM
Does this help?
javax.bluetooth.UUID