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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: usage and installation of independent library

how about downloading the files?

----------------------------------------------------------
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
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

Nope.

 

The system must be transparent to the user.

 

(Usually I provision several files to the Application)



"Listen carefully, I shall say this only once"
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: usage and installation of independent library

"toString() won't do for .mp3 files, or could it ?"

Could do, if you really wanted.

 

"Then my app won't start because it's built as a dependency"

Then don't make it a dependency.  But that also means separate installs.

 

The issue I have with your approach is the requirement to OTA install a large file.  I have a similar requirement with an application, and am still grappling with the best approach.  I'm tempted to provide them as a download and let the users install them onto their SDCard in whatever fashion best suits them and their data plan.  So those concerned about megabytes used each month can take their SDCard out, download on the PC and stick them directly onto the SDCard themselves.  Those that have the minutes to spare and no data limits can just download on the phone.

 

As I said, still up in the air about this, so very interested in any conclusions reached on this Thread.

Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

Well my solution of choice is still a dependent library.

 

Understandable API, no hacking... Clean and simple.

 

My problem is not in the bandwidth cost but the resource memory consumption.

AFAIK application resources are put in memory when you run the application, right?

 

That's why I put them on file system, but, unfortunately, you cannot remove the resources so they fill up memory needlessly.

 

When exactly is a library loaded in memory (along with its resources) ?

The first time you invoke it or at the same time as the main application ?

 

Thank you for sharing your thoughts



"Listen carefully, I shall say this only once"
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

Peter_Strange was wery kind to answer these questions on a related thread:

 

[separate library had 2MB of resources]

 

1) When are the 2MB allocated in memory ?

 

2) How to avoid that ?

 

3) I don't need the resources from the lib after first invocation, is there a way to 'release' resources ?

 

4) Is there a way to 'flush' library after using it, or will GC take care of that ?

 

 

Peter's answers:

 

1) Flash

2) Don't understand this question.  Aside from memory what else do you have on a BlackBerry?

3) Delete the cod - CodeModuleManager will help you here I think

4) See 3 - the garbage Collector won't help.

 

I would like to fill in the blanks...

 

It seems I don't understand.

Please bear with me.

 

a ) I know applications are stored in flash. But your answer (1) suggests that there is no concept of RAM on BB ? I thought application/library was loaded from flash to RAM when started. Please confirm/deny.

 

b) If there is a separate flash-RAM architecutre on BB, when is a library loaded into RAM and is there a way to clear it out ?

 

c) Answer (3) is unusable in case of dependant library since the main app cannot start if the dependancy is deleted/uninstalled, right?

 

d) too bad GC cannot help me, since I am using the library only once on every application startup, and the app is a background app.

 

Thanks fo your efforts Peter



"Listen carefully, I shall say this only once"
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

I have made two different scenarios and have calculated the difference in Memory consumption.

Context: Main app uses a Library app.

 

1) Library app has no resources attached

2) Library app has arround 4MB of resources  (several files) attached

 

This is the result of my testing ( 2 -1 ):

 

 

 

Memory Statistic              # objects  Bytes in use  Allocated      Free
Object Handles                        0      -4463884     -10863     10863
RAM                              -10997      -4348636   -4305016   4306636
Flash                               134       -115248    4277928  -4278716
Transient objects (flash)          -265        -99940      -6784  -4278716
Persistent objects (flash)         -159        -15308     -15308  -4278716
Code modules (flash)                558             0    4300020  -4278716

 

 

The results clearly indicate that cod modules now use up more flash. But how come RAM allocation decreased? (Please ignore the fact that the decrease in RAM allocation size is very similar to the resources size because I reproduced the test and had diffent footprint - but again a significant decrease!)

 

So the conclusion is quite strange:

The Flash allocation has (obvoiusly) increased, but RAM allocation has decreased !?

Well I guess I just have to live with the fact that I cannot do anythig about it Smiley Happy

 

Please leave any comments if you want to discuss the topic any further.

 



"Listen carefully, I shall say this only once"
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: usage and installation of independent library

Just want to confirm one thing.

 

I have suggested that you don't make the Library a dependency.  To do this, you need to find some non dependent way to get the data out of the Library, such as creating an instance of a Class and then using a toString().

 

If you did this, then you could get rid of the module, but the user would have to do  separate install.  So there are two downsides:

 

a) two Installs

b) some work on the toString method to create a String that can be turned back into whatever you want.

 

If you do not do this, then, as far as I can see, you can give up on the idea of shipping the data in a cod that may subsequently be deleted.

 

Is this clear?

Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

Thanks!

 

Not the solution I hoped for but you sure hit the point i was trying to make.

 

The only drawback is that the toString is a one-way communication, that means that the app has to

take all the resources at once an at first shot.

 

But atleast it's doable.

 

Thanks all !

 



"Listen carefully, I shall say this only once"
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: usage and installation of independent library

I suspect you can have more than one class in your 'resources' cod, create an instance and do a toString from each?

Highlighted
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: usage and installation of independent library

Great tip, as usual Smiley Happy

 

Thanks



"Listen carefully, I shall say this only once"