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

Reply
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified
Accepted Solution

same package structure in two applications will work?

[ Edited ]

Hi,

I have Source code of one application, which is in the market.  I need to add few features and want to release as new application, thats client requirement.  It contains persistentstore and rms and sqlite.  

Do I need change the package structure for the application? and what to change regarding PersistentStore and rms and sqlite so that it can not disturb/override the already existing the application contents.

 

Please help on this

 

 

 

Please use plain text.
Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10

Re: same package structure in two applications will work?

The package structure has not to be changed. But the application should get another name. And you have to change all the PersistentStore keys.

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: same package structure in two applications will work?

Just to clarify the previous answer a little, you can have two different applications on the same device sharing class names (by class name I mean the fully qualified name including the package) if the classes are not persistent.

 

If you have persistent classes, then the names must be unique. 

 

If you are sharing code, then any other identifiers, such as ids for PersistentStore and RuntimeStore, directory names for SD Card (and SQLite databases), BBM id, Application name, and ids for various services like social media and analytics, must also be different.

 

In my experience, the biggest issue when attempting to share code is the requirement to have unique persistent objects.  One way to handle this, is to have the creation of the Persistent Object be done in the non shared application code, using a class that implements an Interface that defines a shared set of methods.  So the shared code uses the Interface to access the persisted data, and so is, well, shared.  But the actual object persisted is specific to the Application.  Hope this is clear. 

Please use plain text.
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

Re: same package structure in two applications will work?

Ya name I am going to change, Does any other resouces associate with the Package structure, like images or Database, PersistentStore class name...

 

?

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: same package structure in two applications will work?

Sorry I don't understand that question.  Can you give me an example?

 

Each application is effectively loaded independently.  The issue with needing PersistentStore Object being unique comes about from the need for the BB to remove the classes associated with an application when that application is removed.  So there has to be a one to one relationship between persisted classes and applications. 

Please use plain text.
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

Re: same package structure in two applications will work?

[ Edited ]

Do we need to change RuntimeStore keys/Ids and GlobalEvents and SystemEvents Ids/keys ?

 

in my code there are few RuntimeStore, GloblaEvents and System Events GUIDs are hard coded and I dont know, from where he is taking these constants

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: same package structure in two applications will work?

Yes, you need to change these as these are shared IDs and will cause conflict/confusion if the same ID is used.  

Please use plain text.
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

Re: same package structure in two applications will work?

Is there any way to convert the long value ( that is a GUID converted from a String) to String. Please suggest

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: same package structure in two applications will work?

Not sure I understand the question.

 

String longString = Long.toString(12345);

long longValue = Long.parseLong(longString);

Please use plain text.
Contributor
khalandar
Posts: 41
Registered: ‎09-27-2010
My Device: Not Specified

Re: same package structure in two applications will work?

No, not this :smileyhappy:

 

Actually the String can be converted to Long using JDE plugin right, For example if a String "com.sample.Sample.java" can be converted to '0x2ee0da71db0405e6L'  to use as a GUID, now is there any way to get String from this long value

i.e from '0x2ee0da71db0405e6L' to  "com.sample.Sample.java"

Please use plain text.