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
kusumat
Posts: 26
Registered: ‎07-26-2010
My Device: Not Specified

Persistable issue

Hi,

 

Here i am referring to "com.rim.samples.device.notificationsdemo"

ConsequenceImpl$Configuration  which extends Persistable

 

 

Question : what is the use of Persistable here.

What is the object we are saving  to restore between device restores.

 

 

My issue: i have used ConsequenceImpl$Configuration in my project creating

 

Error starting CMO: Clas 'com.myorg.api.push.ConsequenceImpl$Configuration' multiply defined

 

I know that only one library should be maintained for any number of apps.

 

But our platform architecture is different which includes library for every application all the times.

 

Let me know if my solutions works.  

 

I will create simple library.

 

ClientApp1 will include the library.

 

When i install ClientApp2 - it will look whether lib exist . if exist then that library will not get loaded.

 

Will this workout??

 

thanks,

kusuma

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

Re: Persistable issue

You ask:

"Let me know if my solutions works.  

I will create simple library.

ClientApp1 will include the library.

When i install ClientApp2 - it will look whether lib exist . if exist then that library will not get loaded."

 

There are ways you can do this.  But you need to be very clever about it.  This is because the BlackBerry 'pre-links'. 

 

So let us say if you an application A and it uses Library 1.  In application A you have code that directly references classes in library 1, it could be something simple like:

LibraryClass lc = new LibraryClass();

where LibraryClass is a class in your Library.

 

Given you have this, then application A will only ever start if Library 1 is present on the device.  So you can't put code in application A to check is Library 1 is present.  It has to be present for application A to even start.

 

Looking at your case, what this means, is this probably won't work:

"When i install ClientApp2 - it will look whether lib exist"

If you are using the lib directly, then ClientApp2 will only ever start if lib is on the device. 

 

But back to your original problem.

 

It is possible to have two identically named classes on the BlackBerry if these are not persistable. But you will get the multiply defined issue if you try to have two identically named classes on the BlackBerry that are persistable. 

 

This throws lots of curve balls in when trying to create shared Libraries.  But again there are ways round this.  You can for example use Interfaces to abstract the Library classes and so build persistent classes in the application that deliver data to your shared library code via this Interface.  This probably makes no sense, until actually you try to do it.

 

This article has some very useful information regarding using Libraries:

http://supportforums.blackberry.com/t5/Java-Development/Working-with-Libraries-shared-bundled-releas...

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Persistable issue

simple: persistent classes can only exist once.
use them only in the library, for example.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter