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

BlackBerry® World™ Development

Reply
Developer
RLord321
Posts: 343
Registered: ‎02-23-2009
My Device: 8700 | 8310 | BOLD | STORM

Re: Dynamic Licensing Clarification

I believe you are correct.  There are some things that are for your entire application regardles of what version or release it is and I believe the licesning is one of them...along with Price, etc.

 

But here's the thing... you can put a check in your web server to check for version 1 and if so, you can send back "Key Not Required" and that's what the customer will see.  So all version 1 customers will see that.  You said you did a test with the upgraded version and it failed.  Can you elaborate?  Because if you were testing by buying the upgraded version, it should have went to your web server and generated a key regardless if version 1's licensing model was also changed to Dynamic Licensing.

 

Did you see your test request in your log?

 

 

Developer
LMcRae
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

  I can see the Test Request from storefrontmanager@rim.com and is says success.  So its possible that new purchases are working.

 

  I have the following releases to date without codes: v1.0, v1.05 and v1.0.12.  I did a new release v2.0 that I added, among other things, the dynamic license support.

 

  Here is what I am considering to be a failure for the update.   I purchased the product a after the initial release and have been following the upgrades ever since to make sure they work.  I would recommend people do this BTW.  So again I went to App World to do the upgrade.  Since I have been using my Storm to dev the new version, I had to wipe it from my phone.  So App World found the archived version and had me install that v1.0.12.  Then after that was finished it said there was an upgrade for v2.0.  I then installed v2.0 and ran the app.  Finally my app came up with an activation screen wanting a code.  Through the whole process there was never a mention of a code and I can't see where I can find one.  Also there was no record of this upgrade on my webserver.

 

  So I am now guessing that for new purchases that the worse case is that users are being presented with activation code and having to paste them into my activation screen.  The JAD key method may or may not be working.  Guess I will never know unless I make a new PayPal account.  Also people that are upgrading are going to be emailing me pretty mad.

 

  No comments from someone at RIM?  The docs are pretty good for what they cover but they don't cover everything.

 

P.S I wonder just how much thieving is going on anyway.

 

 

 

 

 

 

Developer
LMcRae
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

I have managed to get this to work for the most part. So I thought I would post my findings.

 

1) I uninstalled my app via MyWorld.
2) Did a battery pull.
3) Started the phone and logged into MyWorld using my PayPal account.
4) Installed the app. It installed v1.0.0 but it now gave me my key to copy to the clipboard.
5) I then quit and looked at my app again and it said there was a free upgrade for v2.0. 

6) I installed v2.0 and then it wanted to reboot.
7) After reboot I went to downloads and started the app and it bypassed my activation screen.  So the code to retrieve from the JAD must have worked.

 

  AFAIK the main difference is the battery pull after uninstalling the first time. I did the battery pull because I saw my app still in downloads but I couldn't interact with it, some kind of archive or ghost.  So I thought I would do a battery pull and then see if I could delete it but it was gone when it rebooted.

 

 Clearly there is a bug but I guess this is a workaround of sorts.

 

New Developer
trshivku
Posts: 9
Registered: ‎11-18-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

 When i try the following code in simulator, it does not find the current app in the groupArray ? Is this an issue with the simulator ? The moduleName is being set to the proper name. Has anyone faced a similar issue ?

 

TIA.

 

-TRS

 

        CodeModuleGroup group = null;
        CodeModuleGroup[] groupArray = CodeModuleGroupManager.loadAll();
                    
        String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();
        
        for( int i = 0; i < groupArray.length; i++ ) {
            String moduleGroupName = groupArray[i].getName();
            String friendlyName = groupArray[i].getFriendlyName();
            
            if( groupArray[i].containsModule( moduleName )) {
                group = groupArray[i];
                break;
            }
        }
Developer
LMcRae
Posts: 163
Registered: ‎04-16-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

 


trshivku wrote:

 When i try the following code in simulator, it does not find the current app in the groupArray ? Is this an issue with the simulator ? The moduleName is being set to the proper name. Has anyone faced a similar issue ?

 

TIA.

 

-TRS

 

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

 

 

It doesn't find the group since CodeModuleGroupManager.loadAll() returns null when running in the simulator.  I am not sure why and was one of the reason I was very concerned about using the code.  For what it's worth my app seems to find the license using the following code.  You can verify this by purchasing Wrath and seeing if you need to paste the key :smileyhappy:

 

 

	private String getAppWorldLicenseKey()
	{
		ApplicationDescriptor	appDesc = ApplicationDescriptor.currentApplicationDescriptor();
		if ( appDesc != null )
		{
			String	moduleName  = appDesc.getModuleName();
			if ( moduleName != null )
			{
				CodeModuleGroup[]	groupArray	= CodeModuleGroupManager.loadAll();
				if ( groupArray != null )
				{
					CodeModuleGroup	group = null;

					for( int i = 0; i < groupArray.length; i++ )
					{
					   if ( groupArray[i].containsModule( moduleName ) == true )
					   {
						  group = groupArray[i];
						  break;
					   }
					}

					if ( group != null )
					{
						String key = group.getProperty( "RIM_APP_WORLD_LICENSE_KEY" );

						return key;
					}
				}
			}
		}

		return null;
	}

 

 

 

 

 

New Developer
trshivku
Posts: 9
Registered: ‎11-18-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

Thanks for the response.

 

> It doesn't find the group since CodeModuleGroupManager.loadAll() returns null when running in the simulator. 

 

If it returned null i would have been happy. For me it returns 34 items in the array and each of them is valid. It finds all the apps on the Simulator except the one that is current running :smileysad:

 

TIA.

 

-TRS

 

New Developer
trshivku
Posts: 9
Registered: ‎11-18-2009
My Device: Not Specified

Re: Dynamic Licensing Clarification

http://supportforums.blackberry.com/t5/Java-Development/CodeModuleGroupManager-loadAll-returns-null/...

 

This page contains an explanation of when a code group is created. Quoting from there:


A CodeModuleGroup is created for an application when it is installed with the following exceptions:

 

A group is NOT created if you use javaloader to load the application by specifying the COD file names.

A group is NOT created when a COD file is copied into the BlackBerry Simulator directory (this is what occurs when you test/debug your application).


 

This makes it clear what to expect :smileyhappy:

Regular Contributor
devin
Posts: 51
Registered: ‎05-11-2010
My Device: 8900

Re: Dynamic Licensing Clarification

So, if I were to extend your code to get the actual key I would do something like this:

 

private static final String RIM_APP_WORLD_LICENSE_KEY = "RIM_APP_WORLD_LICENSE_KEY";

  String key = "";

 

      if (group != null) {
            key = group.getProperty( RIM_APP_WORLD_LICENSE_KEY );
        }

 

Just want to make sure I am getting the actual license key properly.  This is the license key that is generated by the call to my license generator site on purchase?

 

Thanks.

Contributor
liuksmith
Posts: 41
Registered: ‎09-13-2011
My Device: BlackBerry Z10 Limited Edition

Re: Dynamic Licensing Clarification

Hi Mike,

how I can use dymanic license on Payment service?

How I can retrieve RIM_APP_WORLD_LICENSE_KEY inside PurchaseResult object?

 

regards

Luca

Contributor
liuksmith
Posts: 41
Registered: ‎09-13-2011
My Device: BlackBerry Z10 Limited Edition

Re: Dynamic Licensing Clarification

Yes, it's possible using getLicenseKey() method!

 

    PurchaseResult purchase = engine.purchase(arguments.build());
    String license=purchase.getLicenseKey();