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
Contributor
Posts: 30
Registered: ‎10-07-2011
My Device: developer
My Carrier: HÍ

where to implement dynamic licence logic?

Hello,

 

I have one question regarding with code location of dynamic licence.

To check / get licence, I am using:

CodeModuleGroup group = null;
    	CodeModuleGroup[] groupArray = CodeModuleGroupManager.loadAll();
    	if (groupArray != null) {
    	    String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();
    	    for (int i = 0; i < groupArray.length; ++i) {
    	        if (groupArray[i].containsModule(moduleName)) {
    	            group = groupArray[i];
    	            break;
    	        }
    	    }

    	    // find license code
    	    if (group != null) {
    	        String lc = group.getProperty("RIM_APP_WORLD_LICENSE_KEY");
    	        if (lc != null && isUnlockCode(lc))
    	        {
    	            ProgramMain theApp = new ProgramMain();       
    	            theApp.enterEventDispatcher();
    	        }
    	    }
    	}

 Where is correct location of this code? I am using it in ProgramMain.java in

public static void main(String[] args)

 method.

 

Is it correct place?

 

Thanks in advance.

 

F.

Developer
Posts: 19,624
Registered: ‎07-14-2008
My Device: Not Specified

Re: where to implement dynamic license logic?

You can put it wherever you like.

 

One approach is to check the license once the app has started up.  Then you can push a License Screen, if the app is not licensed.  This will block the app until the user enters a valid license.  This approach provides an alternative way of distributing the application - you can do it through App World, or you can do it yourself and supply people with licenses that they can enter.

 

Just a thought. 

Contributor
Posts: 30
Registered: ‎10-07-2011
My Device: developer
My Carrier: HÍ

Re: where to implement dynamic license logic?

Thanks Peter, so it seems, that location of the licence logic is correct.

 

F.