05-25-2010 06:52 PM
I have a set of classes which I would like to reuse in many projects.
In the past, I have created a library that I reference in multiple projects. But how can I facilitate the distribution of said library with OTA installation and through the BB App World?
05-25-2010 11:04 PM
You can package it as a background app and it listens to a global event. Upon receiving a predefine event, you create an instance of an object and send it back to the requestor.
05-26-2010 03:58 AM
You ask a very good question and one to which there is not a perfect answer. However RIM are aware of the issue of library cods - we had a round table discussion about them at the last DevCon.
At present, as far as I know, the only way to do this effectively and to make it possible to maintain the library and the applications as separate entities is to package them as completely separate 'downloads'. So OTA, you have a library OTA install, then the application(s), for App World, you need to do the same.
05-26-2010 06:42 AM
I agree with Aviator's solution.
It's the only working solution currently.
Unfortunately you cannot set dependency that way (- consequence: cannot use strongly typed class) , but you cannot do that (completely) for peter's suggestion neither. (OK, if you can live with that "library file missing" error and burdening the user by asking for an additional download ! -> absolutely terrible solution I must add)
Just try it out: install app1 with lib1. OTA provision it. install app2 with lib1. OTA provision it.
AFAIR the app1 will be mysteriously removed
Then try to provision just the lib1.1 (lib1 with an update) again, the last associated application will be removed.
But alas that completely misses the point of independent library development/provisioning.
05-26-2010 09:51 AM
Thank you for all of your suggestions amd thoughts. Aviator, could you go into a bit more detail as to how this is possible?
I understand the concept of retrieving the object from a background application but I am not sure how the background library would be installed and maintained.
05-26-2010 09:56 AM
We install ksoap as a separate library and have installed several products on one device without any of them getting removed.
alx/jad refer to two cod files, the application file and the library file.
05-26-2010 02:19 PM
I must admit that I did not understand how Avaitor168's response was actually a solution to the question asked. Yes, you can have some loose interaction and have the process return a random Object, but how will the invoking application actually know what to do with that Object?
Similarly, I do not completely understand myraddin's post.
I agree with Simon. The most workable solution at the moment is to have the library in a separate package. It is not perfect, The problem is highlighted by myraddin's comment
"OK, if you can live with that "library file missing" error and burdening the user by asking for an additional download ! -> absolutely terrible solution I must add"
However I think a 'library is missing error' once, at installation time, is better than a delete of one application causing other applications to fail and is small price to pay for being able directly use the
Library from your application.
Installation is a one-off event, with good documentation is having to do two downloads a big deal?
But that is just my opinion.
05-27-2010 03:29 AM
but why two downloads? if i manually add the library cod to the main application jad file (or alx file) the library is installed, but i don't experience the problem of an app no longer working when i delete the other.
i just tested it on my phone. installed are app A and B, both have ksoap2 as a library, installed as a separate cod.
both are running fine. i uninstall A, reboot the phone. B is still working and still has ksoap2 listed as a module.
the process is transparent to the user, no interaction required.
05-27-2010 04:01 AM
Thanks for trying that Simon.
I had found in the past that this did not always work as I would have expected.
To describe what I tested, assume you have two applications with one shared library. Call the applications A and B, and the shared library Z. To install these OTA, I created two jads, Jad 1 with A & Z, and jad 2 with B & Z. I installed jad 1 and then jad 2, then deleted the application installed with jad 1. I got different results on different devices as follows:
a) On some devices installing jad 2 removed jad 1
b) On some devices deleting jad 1 removed the library and so jad 2 stopped working
c) On some devices it worked as expected.
This testing was a while ago, from memory at the time I did the test the most current OS I had was an early 4.6 device, so it was probablyabout 18 months ago. So I should run the test again.
05-27-2010 04:06 AM
Simon, can you confirm that this is the scenario:
1) OTA provision A + ksoap2. (single .jad file provisioning)
2) OTA provtions B + ksoap2. (again, single .jad file provisioning)
3) You can now separately OTA provision another (let's say updated) ksoap2 ?
4) You can uninstall either App A or B and the other one is untouched ?
5) You can uninstall ksoap2 and running A and/or B just reports: "library missing" ?
3), 4) and 5) all answered YES should be the proper library handling.
I am curiously awaiting for your reply.