08-30-2013 06:07 AM
I'm developing for API 5.0+, java.
I am confused about RuntimeStore ID. I've read that
- it should be unique and can be generated with eclipse, right click, etc.....
- I can use any number I like
I tried my application on simulators and it worked fine, but when I tried it on a real device then RuntimeStore returned and object that was not put there by me (it returned a NoMoreTransportsException object. ), so I hought I used a non unique ID, probably. I changed it and now it works OK.
1. The ID should be unique in the application or in the system?
- If only for the app, then why not to use just a simple serial as 1,2,3,...
- If only for the app, then why was there an object in the RuntimeStore for that ID I used? (as I mentioned above)
- If for the system, then how can be sure, that the generated ID is really unique? (Long datatype cannot hold a real GUID)
2. If I would like to put a String to RuntimeStore, how to generate a unique ID? Someone said I should use the fully qualified name of the class, so Eclipse generated hash for java.lang.String is 0xd4e2de8aa7759716L, right?
- In this case if the id should be system unique, what happens if an other application is already using this ID, because it was generated the same way (java.lang.String -> 0xd4e2....)
Solved! Go to Solution.
08-30-2013 07:10 AM
08-30-2013 07:20 AM
1. So the ID should be SYSTEM UNIQUE and it is not a good idea to use for example 'java.lang.String' as a base string for the hash
2. By the way a real GUID consists of 16 bytes, while this ID is just 8 bytes
08-30-2013 07:30 AM