07-22-2009 09:10 AM
No, I am able to bundle the renamed cod files. The renamed cod file installs fine, but I am expected that when I go to Options -> Advanced Options ->Applications -> Menu Key -> Modules, that I would see the module name be the same as the file name.
Maybe I didn't understand your first post, but here I what I thought would happen.
Given an already compiled app called helloWorld.cod and helloWorld.jad
Create a new project called com_mysite
compile it to get get com_mysite.cod and com_mysite.jad
run updatejad.exe helloWorld.jad com_mysite.jad
which produces something like
MIDlet-1: Hello World,,
RIM-COD-SHA1: c6 c0 69 4d 2a 74 25 ab fa 90 22 78 20 31 2e 64 a2 db 27 d3
I then install by browsing to helloWorld.jad which installs helloWorld.cod and com_mysite.cod. The module name for com_mysite.cod appears as com_mysite
Now for the second download I rename com_mysite.cod to com_mysite_test1.cod and change RIM-COD-URL-1: to com_mysite_test1.cod
Then install on another Blackberry by browsing to helloWorld.jad which installs helloWorld.cod and com_mysite_test1.cod. But the module name for com_mysite_test1.cod appears as com_mysite when I call CodeModuleManager.getModuleName(). I can't find com_mysite_test1 anywhere on the device.
Again thanks for any help you can provide
07-22-2009 09:18 AM - edited 07-22-2009 09:19 AM
I will check that a bit later and post here.
It becomes a very interesting issue for me
07-22-2009 03:05 PM
So, I am back
I investigated internal cod file structure with hex editor.
See image below.
It shows that cod file has included cod module name. And rename of cod module file does not make any affect on real cod module name.
I created file com_dummy.cod and after that renamed it to com_dummy_1. But inside there is com_dummy string stored.
I recommend to automatically compile a simple cod file and deploy it along with your application in jad file.
07-22-2009 03:23 PM
You really must like the challenge to dig in with a Hex editor
I just hate the idea of doing a compile realtime while someone is waiting for a download (so much to go wrong). But now I am thinking that maybe I can alter the cod file as I return it via the HTTP request. I am not signing the file and I don't have to provide the SHA1 hash for this file (there is no tag for it in the JAD file) so I think that if I compile the project with a name of com_mySite_xxxxxxxxxx, then when ever I server the COD file from the web server I can find com_mySite_xxxxxxxxxx and replace it with com_mySite_0000000001. Keeping the byte count the same even, so I don't have to worry about change the cod size value in the JAD.
I will test this in a little while and post the results.
This sure is a lot of work to just support 4.2 device... The dynamic JAD in 4.3 works so nice.
Again I really appreicate the extra effort. I must also thank you for all the other posts that you have done on this forum as they have helped me lot.
07-22-2009 03:30 PM - edited 07-22-2009 03:30 PM
Just an idea, did not check it.
Compile a dummy cod file with name like: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
And change the cod name into the cod file binaries via simple application that takes a parameter, copies this cod file to the necessary filename and makes cod module name update inside of file binaries.
long filename preserves enough space to be used for your renamer utility. The rest unused symbols inside of binaries can be set to space symbol or null symbol. It should be checked, but it is easy.
What do you think ?
07-22-2009 06:30 PM
I opened the COD file in a binary editor and replaced the module text with new text and then downloaded the file and it installed without error and now displays the new module name. So looks like this might actually work. Now I just have to write some C# code to change the COD file on the webserver during the download process.
07-22-2009 08:35 PM
I also learned that the module name appears three times in my COD file, if I changed just the last one then CodeModuleManager.getModuleName() worked and return the new string, but I was not able to read/load resources from the COD file.
I had to change all three strings inorder to be able to read resources from the COD file.