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
redpath
Posts: 62
Registered: ‎07-29-2008
My Device: Not Specified
Accepted Solution

use different JADs to deploy one COD with different properties

I never got different JADs to work for website deployment.

 

Here is the problem, I use MIDLET getAppProperty to get a property.

I build a myMidlet.COD file with myMidlet.jad which has a HOST property.

 

I have on a website ten different JADs with different HOST property for

the one myMidlet.COD to be deployed. The midelt deploys nicely to the Blackberry

but the HOST is the same one used to build the COD. I was given an excerpt of code and

added some debug statements to see what this Module thing is 

 

public class mybbProperty {
    CodeModuleGroup[] allGroups;
    CodeModuleGroup myGroup = null;
    String moduleName;
    boolean flag=true;

    public void mybbProperty(){
    }

    public void init(){
        versForm.debugtext+="\n init";

        CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
        versForm.debugtext+="\ngroup";
        moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();
        versForm.debugtext+="\n mode "+moduleName;   //note modulename is correct and is "myMidlet"

 

        for (int i = 0; i < allGroups.length; i++) {
//      versForm.debugtext+="\n"+allGroups[i].getFriendlyName();

            if (allGroups[i].getFriendlyName().equals("myMidlet")) {
                versForm.debugtext+="\n"+allGroups[i].getFriendlyName();
                versForm.debugtext+="\n **found";
                for (Enumeration e = allGroups[i].getModules();
                    e.hasMoreElements() :smileywink: {
                    versForm.debugtext+="\n **"+e.nextElement();
                }
                myGroup = allGroups[i];
                break;
            }
//            for (Enumeration e = allGroups[i].getModules();
//                e.hasMoreElements() :smileywink: {
//                versForm.debugtext+="\n **"+e.nextElement();
//            }


            if (allGroups[i].containsModule(moduleName)) {
                myGroup = allGroups[i];
                break;
            }
        }
        versForm.debugtext+="\n end";

    }

    public String getAppProperty(String name){
        if (flag)
            init();
        flag=false;
        versForm.debugtext+="\n getAppProp "+name;
        if (myGroup==null)
            return null;
        return myGroup.getProperty(name);
    }
}

 

I use the function mybbProperty.getAppProperty("AppMyHost");

 

I noticed that the getFriendlyName() has the name of my Application so I use it and

print out information. What I get is this

 

 mybbProperty mybb= new mybbProperty();

 String                s = mybb.getAppProperty("AppMyHOST");

 

 myMidlet

 **Found

 **myMidlet-3

 **myMidlet-2

 **myMidlet-1 

 

which of course returns NULL. So how do I get properties from another JAD which was used to deploy the

app to the Blackberry. In Nokia its pretty simple use MIDlet getAppProperty() as you need a jad and jar to

deploy it. 

 

Anyway I have no idea which module to get. The JAD I used to deploy the COD was called green.jad

so I have no idea why myMidlet is of importance. Wouldn't I see green.jad somewhere?

 

Anyway, would appreciate any code that does this correctly.

 

BlackBerry Development Advisor
MSohm
Posts: 14,757
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: use different JADs to deploy one COD with different properties

Please see this thread on this issue.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=10&query.id=5227#...

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
redpath
Posts: 62
Registered: ‎07-29-2008
My Device: Not Specified

Re: use different JADs to deploy one COD with different properties

Okay thanks, Will have to test on OS 4.3.0 it does not work on 4.2.1 though the API is available on that

OS the function is not.

 

Thank you solved.