BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-03-2007, 06:39 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default PersistentStore... Where do I get a Key?

Please Login to Remove!

When trying to read/save to a store, you have to call getPersistentObject on the PersistentStore class. My question is where do you get this key? There are many sample applications that has a key already in place but don't explain where they got it...

Do I get this key when I pay $100 to sign my application? If not, what key do I pass to this function? In the simulator I put some random number in there and it works fine, but I know after I sign my cod file, I can just use a random number on the device.
Offline  
Old 09-03-2007, 07:40 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2005
Location: Berlin
Model: 9500
OS: v4.7.0.78
PIN: 20CAFA18
Carrier: O2
Posts: 39
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

It has nothing to do with signing.

One good way it to take your package name, something like com.mylargecorparation.mynewapp and let convert it to a long. (the JDE can convert it for you) This way it would be quite unlikely that some other application will collide with yours.

Some other good ways may be there are ...
Offline  
Old 09-03-2007, 11:26 PM   #3 (permalink)
Thumbs Must Hurt
 
Rose's Avatar
 
Join Date: Nov 2006
Location: India
Model: 9700
OS: Windows 7
Carrier: Airtel
Posts: 121
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by RLord321 View Post
When trying to read/save to a store, you have to call getPersistentObject on the PersistentStore class. My question is where do you get this key? There are many sample applications that has a key already in place but don't explain where they got it...

Do I get this key when I pay $100 to sign my application? If not, what key do I pass to this function? In the simulator I put some random number in there and it works fine, but I know after I sign my cod file, I can just use a random number on the device.
As stated by RLord321 the persisitence key is what that is created by the user during the creation of persistence store..
It is nothing but a long value of a string.. Which can be created from the JDE ..
Steps : type a string select it and right click from the JDE which shows convert string to long. Then you will get the value.

This key is essential to store a object in the persistence store and retrieve the object.
Offline  
Old 09-04-2007, 12:26 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

This sounds good...but what if there IS a name clash? If I stored something with key ABC, and someone else is storing with key ABC, would that overwrite everything? Also, could someone else peek at any data stored on the device by simply guessing at a key?

I guess maybe an application should put in some type of signature in the store just to make sure that the store is really theirs? Like I could always store a string that says, "ThisMyApp333"..and if I check to see if that string is there, I know its really mine...
Offline  
Old 09-05-2007, 06:58 AM   #5 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

to be sure it's unique use the format:

com.mycompany.myproduct.myclass.myobject

if you want to ensure nobody can guess your hash and write an app to extract it just bolt on some random characters:

//com.mycompany.myproduct.myclass.myobject.dsihcge89 6372fg13

which gives:

//0x6aa2895dcd968123L
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.