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

Reply
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Need to create/access a unique string per OTA install of application

Please correct me if I am wrong.

 

You are unable to bundle renamed cod file with your application file ?

New Developer
Posts: 13
Registered: ‎07-18-2009
My Device: Not Specified

Re: Need to create/access a unique string per OTA install of application

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 

 

Manifest-Version: 1.0
MIDlet-Version: 0.0.0.1
MIDlet-Jar-Size: 4521
MicroEdition-Configuration: CLDC-1.1
MIDlet-Jar-URL: helloWorld.jar
RIM-COD-Module-Dependencies: net_rim_cldc
RIM-MIDlet-Flags-1: 0
RIM-COD-Module-Name: helloWorld
MIDlet-Name: helloWorld
RIM-COD-Size: 2624
RIM-COD-Creation-Time: 1248041470
MIDlet-1: Hello World,,
RIM-COD-URL: helloWorld.cod
MIDlet-Description:
RIM-COD-SHA1: c6 c0 69 4d 2a 74 25 ab fa 90 22 78 20 31 2e 64 a2 db 27 d3
MicroEdition-Profile: MIDP-2.0
MIDlet-Vendor: mysite
RIM-COD-URL-1: com_mysite.cod
RIM-COD-Size-1: 10112

 

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

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Need to create/access a unique string per OTA install of application

[ Edited ]

I will check that a bit later and post here.

 

It becomes a very interesting issue for me :smileyhappy:

 

 

Message Edited by tbilisoft on 22-07-2009 02:19 PM
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Need to create/access a unique string per OTA install of application

I can reproduce this issue.

 

It is good.

 

Later I will check it more closely and post results here.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Need to create/access a unique string per OTA install of application

So, I am back :smileyhappy:

 

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.

 

dummyHex.png

New Developer
Posts: 13
Registered: ‎07-18-2009
My Device: Not Specified

Re: Need to create/access a unique string per OTA install of application

 

You really must like the challenge to dig in with a Hex editor :smileyhappy:

 

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.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Need to create/access a unique string per OTA install of application

[ Edited ]

Just an idea, did not check it.

 

Compile a dummy cod file with name like: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.cod

 

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 ?

Message Edited by tbilisoft on 22-07-2009 08:30 PM
New Developer
Posts: 13
Registered: ‎07-18-2009
My Device: Not Specified

Re: Need to create/access a unique string per OTA install of application

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.

 

 

New Developer
Posts: 13
Registered: ‎07-18-2009
My Device: Not Specified

Re: Need to create/access a unique string per OTA install of application

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.