11-26-2009 03:00 AM
I use a library to carry some data for the Main application and in some cases I need the library uninstalled after using it.
But since I deployed the Main app together with the dependant library, I get the
"Error starting APP: Module 'lib' not found" after uninstalling the library.
I want it to be uninstalled to release its resources and free up memory (since I already took what I need from it).
So the question is:
How can I use a library without setting the dependency property, and use DM or OTA provisioning in one packet at the same time ?
Solved! Go to Solution.
11-26-2009 03:19 AM
Thanks for your input on the subject.
I am doing that now.
Am I missing something ?
The compiler (of course) complains if i don't set the dependency of the Main app. It does not recognize the class contained in the library.
But if I do set the dependency everything is OK until I uninstall the library from the device. Then the Main app refuses to start (which makes sense).
How can I use a library without setting my Main app's dependencies ?
(If I do that, uninstalling the library will not prevent the Main app from running).
11-26-2009 03:28 AM
this won't be possible. if your only concern is space you could create a second version of the library, containing only empty interfaces instead of all the data.
or you could create a second app that makes the resources available using runtimestore or similar, which could be deleted afterwards without dependency problems.
11-26-2009 03:41 AM
1) "this won't be possible. if your only concern is space you could create a second version of the library, containing only empty interfaces instead of all the data."
How should I implement that?
The idea is to provision some data in the library. Main App takes the data, writes it to the filesystem and then uninstalls the library thus releasing unnecessary resources.
So the library carries the payload and can be dismissed after usage. But the User will later receive another library with new payload.
2) "or you could create a second app that makes the resources available using runtimestore or similar, which could be deleted afterwards without dependency problems."
I already tried this approach, but I want to remove any constraints posed by the system on the payload app. When using runtime storage, I need the 'interprocess communication' permission, right? It seems quite a mess using a runtime storage since it's a one way communication than. Library is much better approach.
Is there no way to access a library by searching for class name... or something like that (that way I would be able to remove the dependency)?
Thanks for your interest!
11-26-2009 06:42 AM
I tried several approaches and still no luck.
Can something like this work:
fClazz = Class.forName("com.xx.bb.library"); InputStream is = fClazz.getResourceAsStream("/libraryData.txt");
it seems that getResourceAsStream doesn't care about the fClazz part since it never gets any of the Library's data. But if I enter any Main app resource name, the InputStream is correctly initialized !?
Any hints about getting
11-26-2009 06:46 AM
Not tried and not sure, just a thought..
InputStream is = fClazz.getResourceAsStream("cod://[Module Name]/libraryData.txt");
11-26-2009 09:19 AM
It is possible to use the Class.forname to detect whether a package (not a cod file) is installed or not and then create instances of classes within that package and then do something like a 'toString()' on the instance to get data out. I have some code kicking round that does something like this.
So, in short, from your non Library cod, you can detect that the Library cod is present and get data from it.
Actually you can probably use CodeModuleManager to detect the existence of the cod anyway.
That done, the question is how to get your application to stay alive once the the Library has disappeared? The only way I have found is to package the two into separate Applications, with separate downloads, or separate alx's.
However I'm not convinced you want to remove this library cod. I presume you are using it to supply installation options. If you leave it on the device, your user has the option of resetting the configuration to the installation default. Which can be very useful when debugging.
11-26-2009 10:19 AM
toString() won't do for .mp3 files, or could it ?
Let me explain, in short:
1) My Main app is the work horse.
2) On first install and later on I provision some new settings to it
The reason for using this Application (work) + library (settings) scheme is because
sometimes settings are quite large (>1MB) and I write them to the File system but they are still consuming valuble memory space because I cannot release them as resources.
So I thought: put it in a separate library. Hmm... I remembered, but will the library also consume memory ? Well why don't I uninstall the library after using it...
Then my app won't start because it's bulit as a dependency... and so on.
My biggest problem is the fact that i need 1) and 2) but at the same time I want to minimize memory footprint since all the data is on file system anyway.
Sorry for the long post.
Thanks for the effort.