BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-23-2007, 08:43 AM   #1 (permalink)
New Member
 
Join Date: Feb 2007
Model: 7290
Carrier: SE
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Automatic Update Code

Please Login to Remove!

I want to develop code which can be integrated with my blackberry applications. This will check server whether is there any new versions available and if it finds one, then it will automatically download it.

Up to know it may be possible to implement with http connection.

But the problem starts here. How can I change the current version of application with downloaded one in blackberry?


Thanks.
Offline  
Old 05-23-2007, 08:55 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i've done this in the past by comparing the installed version against the version sat on the server, if a newer version is availble i spawn a browser session pointing at the new jad.

getting installed version of an app:
String version = "";
String moduleDescriptor = "myapp";
int moduleHandle = CodeModuleManager.getModuleHandle(moduleDescriptor );
if (moduleHandle > 0 ){
version = CodeModuleManager.getModuleVendor(moduleHandle);
}else{
version = "0.0.0";
}
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 05-23-2007, 09:10 AM   #3 (permalink)
New Member
 
Join Date: Feb 2007
Model: 7290
Carrier: SE
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jonathan,

This information is also useful for me, thanks. But my real problem is not evaluating the versions.

Think that I checked everything and I found a newer version of it with its downloadable URL. What should I do next?

I mean if I download it with using HttpConnection that's allright too. But then, how can I change this application with newer one? (By the way the older version had made version check and download the newer version, so that it may be needed to close before installing newer one. I'm not sure, I'm just asking you)


Thanks.
Offline  
Old 05-23-2007, 09:47 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

don't think you can install using httpconnection but i'm willing to be wrong (given that the blackberry converts the jar as it downloads it though i don't think you're going to be able to do it)

i just spawn the browser by passing it the jad location:

Browser.getDefaultSession().displayPage("http://mysite.com/mynewjad.jad");
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 05-23-2007, 11:01 AM   #5 (permalink)
New Member
 
Join Date: Feb 2007
Model: 7290
Carrier: SE
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Jonathan. I think it will solve my problem.
Offline  
Old 05-24-2007, 12:18 PM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2005
Model: 8830
Carrier: Verizon
Posts: 144
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The security of the BB will not allow you to automatically download or replace the existing application. The best you can do is launch the browser pointed to the jad as jfisher has already explained.

An app that I wrote checks an xml file on the server each day to see if there is a newer version available. The xml file also contains the url of where to go to download the new version, so like jfisher I can then launch the browser. But that's as far as RIM will let you go.

fbrimm
Offline  
Old 05-24-2007, 12:50 PM   #7 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

snap! - exactly the way my app works - except mine checks in the background each time the app is run, if there's an update it notifies the user (never got round to implementing a periodic check which would be much better)
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 05-25-2007, 05:06 AM   #8 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2005
Location: Spain
Model: 7230
Carrier: Movistar
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know if things have changed, but as far as I know if the size of .cod file is largen than 80 or 85 KB the operating system is unable to install the new versión. I dealed with this two years ago and had to develop an updater using CodeModuleManager.
Offline  
Old 05-25-2007, 05:38 AM   #9 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

to overcome this you just extract the cod to expose its smaller sibling cods (change the extension of the cod to zip and extract it)
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.