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.
05-24-2011 06:14 PM
I have had occasion to include larger files and other resources like mp3s, images and videos, in an application. If I include these as resources, I could have a 200 KB application and megabytes of data for that application. I really don't need these in the application cod file and often they would be better stored on the SD Card - in fact some, like primed SQL databases, must be located on the SD Card. So what to do?
And if I include these in the application, and then copy them to the SD Card, the resources are still taking up Application Space too.
I could "side-load" these resources on to the SD Card, for example, by automatically downloading the files from a web site when the application starts, or providing the user with some instructions to download the files into the appropriate directory while their BB is USB connected. But downloading using code on the BlackBerry typically has problems with communication and of course, it is more code to write. Side loading onto the SD Card via the USB connection or other mechanisms, tends to be manual and error prone - even testers, who should understand the technical requirements, botch this up.
So I'm trying a slightly different approach.
I'm adding these resources to a separate application. This separate application is downloaded like any other application (perhaps even with the using application). When it runs, it just copies the resources onto the SD Card, and then deletes itself. And so far (though it is early days) this seems to work OK. It makes updating easy and it takes up no application space!
So I thought I would create a sample application that does this, and make this available. I'm hoping other people would find this useful and/or might be able to provide some feedback or suggestions for improvement.
If you are interested, attached you will find a zip file containing an application in source form. Please download and unzip the zip file, retaining the directory structure. You will find a sample installer application, with JDE workspace and project files. I believe I have commented the code well enough so that you can read it and try it without further instructions. If you don't understand it, please read it again, and review the API's that it uses. I don't think there is anything tricky in here, though of course I could probably have written things a simpler way. .
The sample just copies a small text file from the resources in the application onto a specified directory on the SD Card.
I am confident that you will be able to extend this to do whatever installation steps you want it to take - for example delete a previous version of an application (not necessarily this one), or even install an application from a resource file. At this stage, I'm just using it to load resources onto the SD Card, but you can do whatever you like.
Code is given as is, where is, with no warranty that it is fit for purpose and that it won't trash your BB, though of course, if you find something that looks like a bug, let me know via this Thread. This code should run in any OS that is 4.2 or later.
Assuming this works for you, please use this freely, without reference to me, there is no copyright, no obligations at all.
I just hope it is useful.
10-31-2011 08:46 AM - edited 10-31-2011 08:47 AM
This is a brilliant idea. I have two questions
1. How can I package this with my app and run before my actual app install
2. Is there anyway to loop through files in the res folder?
10-31-2011 08:57 AM
10-31-2011 11:39 AM
1. You can't package it. You can however get your app to check if the resources are present tell the user if the installer has not been run, and maybe (I've not done this, but I can't see why you can't, run the 'installer' if it is around
2. There is not facility to loop through files, you have to know which ones are there. But see later...
Was going to but no one seemed particularly interested
In fact I have an enhancement I would like to publish, which allows people to add a ZIP file as the a resource, and then automatically unzip the zip file and write all the files to the SD Card. I need to get authority to release this code, and of course, if no one is interested, why bother? So let me know if you think this would be a good thing and I shall ask.
11-01-2011 03:53 AM
Thank you for the reply.
I can't think of a reason why this installer is not going to useful for others. So please do a KB artical as Simon suggested. If you improve the code with zip file , my 2nd question would be answered. So looking forward to it..
08-27-2012 04:00 AM
For the record, I have published the unzip code: