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
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Errors reinstalling the app

My customers are having trouble reinstalling my apps. If they install without first deleting the icon and rebooting the phone,they will always get a Java.lang.Error on launching the new app.

 

I know most apps control this by forcinf the phone to reboot before the second launch.

 

Can anyone give me a design pattern to follow for this?

 

Thanks

Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Errors reinstalling the app

I should add that my app uses Persistent Storage. I open the store at the launch of the app and leave it open. I assumed opening and closing it every time I use it would be inefficient. Do I need to close it on shutdown? I was assuming Java would look after that...

 

Could this be causing the problem?

 

What pattern do you follow using persistent storage?

Please use plain text.
Administrator
MSohm
Posts: 14,424
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Errors reinstalling the app

Did your persistable class change (add or remove member variables) between versions?  If so, the user would need to restart when upgrading.

 

Alternatively you could include both persistent classes and programmatically upgrade the object stored in persistent store.

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
Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Errors reinstalling the app

Thanks Mark...

 

My persistent class has not changed substantially. I have occasionally added an item to the object (HashTable) but I also added code to detect and initialize it in the constructor. 

 

Never the less, I mostly had reports of the problem with net new installs.

 

Interestingly... since all of this discussion about app world bugs, I have not had anyone complain about a crash in over a week. So maybe app world was causing it. Delivering a bad JAD file would make sense. This might also explain why it works the second time.

 

This would explain why 

1) it is only the occasional customer (maybe 10-20%)

2) I have never been able to reporduce it..

 

One of the things I did more recently was to wait 500ms before trying to extract the license from the JAD file.

 

This stuff is not an exact science. But it should be.

 

Do you have a minute to look at some 4.5.0 sound problems? Again, this stuff should just work...

http://supportforums.blackberry.com/t5/Java-Development/2-Questions-about-playing-short-mp3/m-p/7644...

 

Thanks

Peter

Please use plain text.
Administrator
MSohm
Posts: 14,424
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Errors reinstalling the app

Have you been able to get an event log from a user with this error?  Does your application auto run on startup?  How large is the application?

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
Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Errors reinstalling the app

[ Edited ]

I have not been able to get the error from the log. Nobody has complained in about a week.  

 

I had some from before that were blowing up in my license module. So I added a time delay before looking for the key from the JAD and I also wrapped talking to the JAD in a try/catch. 

 

I did just have a guy ask for a key that should have got it from App World. So maybe the try/catch preventing him getting the error...

 

Below is my current code for accessing the key in the JAD.

 

 

public synchronized String getKeyAppWorld(){	
	String key = null;
	try {
		CodeModuleGroup group = null;
		CodeModuleGroup[] groupArray = CodeModuleGroupManager.loadAll();	            
		String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName(); // this name
		for( int i = 0; i < groupArray.length; i++ ) {
			if( groupArray[i].containsModule( moduleName )) {
				group = groupArray[i];
				break;
			}
		}// group = this app
		key = (group == null) ? "" : group.getProperty( "RIM_APP_WORLD_LICENSE_KEY" );
	} catch (Exception e) {
		//failed for some reason... 
	}
	return (key == null) ? "":key;
}

 

 

The app is not too big... about 130K. Most of that size are the MP3 files I use for beep sounds - that's another problem I still have.

 

It does not auto start and I made sure all the constructors are private to try to prevent things getting initialized prematurely. Not sure why it would matter but it was pary of my debugging. I'm still not totally clear on when things are supposed to get initialized in the BB app lifecycle.

Please use plain text.
Administrator
MSohm
Posts: 14,424
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Errors reinstalling the app

Since the application doesn't auto-run, that eliminates a potential theory for the error (app tried to run before the system had finished writing out all of the properties).

 

If you do get an event log please post the section that shows this error.

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
Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Errors reinstalling the app

I am still getting the occasional email from people that are missing a license key. I suspect that means the try/catch is catching the exception so there will not be any stack traces any more.

 

Assuming that is true... Given the code above, what timing issues would you expect when dealing with the JAD from App World? I started this thread looking for a reliable pattern to follow rather than all this debugging.

 

I took this code from the examples in the forum. But there must be more stuff that can go wrong...

 

I am compiling this against 4.5.0. Could that be clue? I don't want to have to manage 3-4 different versions for each API. 

 

Thanks

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Errors reinstalling the app

"from people that are missing a license key"

 

Could it be that they are actually missing their key because there was a problem with the license generation?  We have had issues recently because we expect an 8 character hex PIN and App world occasionally gives use the integer version of the PIN, in which case we do not supply the License.  users can see this because there is no license in their My World. 

Please use plain text.
Developer
precisionpete
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: Errors reinstalling the app

Yup! That's where they went. So it's costing me new business too!

Please use plain text.