You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old Check for update feature - how to implement - 2008-12-07, 17:11

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Hi

I am trying to implement a feature for updating my application. Just a "Check for updates" menu entry that downloads the latest .sis file and installs it.

Checking and downloading the sis is really easy but when I call Content_handler to execute it things go bad. It seems that Content_handler runs in the same thread of the calling application. So, when the installer asks for killing the current running application, it is killed as well. In fact, it becomes something like a "zombie" and can not be removed from tasklist anymore.

Reading Python docs, I found e32.start_exe():

e32.start_exe(filename, command [,wait ])

So, it seems that I can call the installer using the sis as its argument.
The question is: where is the installer or any application launcher in S60 ? Is the path for this installer the same for all S60 phones ?

Documentation talks about e32.start_server call as well. Is it possible to call a non-ui script and use Content_handle from it ?

Suggestions are very welcome !

Marcelo Barros
Reply With Quote

#2 Old Re: Check for update feature - how to implement - 2008-12-07, 18:43

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by marcelobarrosalmeida View Post
It seems that Content_handler runs in the same thread of the calling application. So, when the installer asks for killing the current running application, it is killed as well. In fact, it becomes something like a "zombie" and can not be removed from tasklist anymore.
Good find!


Quote:
Originally Posted by marcelobarrosalmeida View Post
The question is: where is the installer or any application launcher in S60 ? Is the path for this installer the same for all S60 phones ?
I wouldn't count on it.


Quote:
Originally Posted by marcelobarrosalmeida View Post
Documentation talks about e32.start_server call as well. Is it possible to call a non-ui script and use Content_handle from it ?
Not according to the PyS60 v1.4.5 documentation (page 16, or 10 according to page numbers):

Quote:
start server(filename )

Starts the Python script in file filename (Unicode) as a server in its own process. Note that appuifw module is not available to a server script.
Content_handler() is part of appuifw.

You could create two SIS files with Ensymble and merge them. One for your application and one for an "update agent", which handles the update procedure from a separate process. Your application could then run the update agent periodically or on demand and it would determine if there are updates available and install them.
Reply With Quote

#3 Old Re: Check for update feature - how to implement - 2008-12-07, 19:02

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by jethro.fn View Post
You could create two SIS files with Ensymble and merge them. One for your application and one for an "update agent", which handles the update procedure from a separate process. Your application could then run the update agent periodically or on demand and it would determine if there are updates available and install them.
Hi Jussi,

He could do that mergesis, but I think that's not the point. He said that he can download the package but don't know how to install the .sis file downloaded. He would still have the same issue if using mergesis. Actually, I don't know any way to do this, I will search more


BR,

Rafael.
Reply With Quote

#4 Old Re: Check for update feature - how to implement - 2008-12-07, 19:03

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Continuing the idea of an update agent...

The agent itself would probably need to be updated less frequently. A PyS60 program can overwrite its own files under the private directory, so updates to the update agent could be in the form of a zip file or something similar. The update agent would unpack the zip file in the private directory, overwriting its files with new ones. The only downside is that there can be no changes to files outside the private directory.
Reply With Quote

#5 Old Re: Check for update feature - how to implement - 2008-12-07, 19:08

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by jethro.fn View Post
Continuing the idea of an update agent...

The agent itself would probably need to be updated less frequently. A PyS60 program can overwrite its own files under the private directory, so updates to the update agent could be in the form of a zip file or something similar. The update agent would unpack the zip file in the private directory, overwriting its files with new ones. The only downside is that there can be no changes to files outside the private directory.
Good idea! Haven't thought about that

I think he wouldn't need files outside the private directory, so this should be the best option


BR,

Rafael.
Reply With Quote

#6 Old Re: Check for update feature - how to implement - 2008-12-07, 19:09

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by Rafael T. View Post
I could do that mergesis, but I think that's not the point. He said that he can download the package but don't know how to install the .sis file downloaded. He would still have the same issue if using mergesis. Actually, I don't know anyway to do this, I will search for this
No, he can start the installer but the installer insists on stopping the running application. Because the application process is now running the installer (via Content_handler()), the installer will kill itself, resulting in a deadlock. This can be worked around by moving the installer out of the application process. One way to do it is to use a separate "update agent" application to do the work.

By the way, there's also open_standalone() for Content_handler(). It uses a separate process and might allow the original application to close before the update takes place.
Reply With Quote

#7 Old Re: Check for update feature - how to implement - 2008-12-07, 21:05

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by jethro.fn View Post
No, he can start the installer but the installer insists on stopping the running application. Because the application process is now running the installer (via Content_handler()), the installer will kill itself, resulting in a deadlock. This can be worked around by moving the installer out of the application process. One way to do it is to use a separate "update agent" application to do the work.

By the way, there's also open_standalone() for Content_handler(). It uses a separate process and might allow the original application to close before the update takes place.
Yes, yes, you're right ... just checked the Library Reference

open_standlone() seems to be a good option


BR,

Rafael.
Reply With Quote

#8 Old Re: Check for update feature - how to implement - 2008-12-07, 22:06

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Hi !

Before testing something more elaborated, like sis with two programs, I tested open_standalone(). I really seemed to be the solution. I did something like below:

Code:
viewer = Content_handler( lambda: None )
try:
    viewer.open_standalone( local_file )
except:
    note(u"Impossible to open %s" % local_file,"error")
Installer is normally started but it fails with the message: "The installation was canceled". I tried to close my application just after calling open_standalone as well. Same result and message, unfortunately.

Documentation statement: "The handler application is started in its own process". So, what happened ?

Reply With Quote

#9 Old Re: Check for update feature - how to implement - 2008-12-08, 11:14

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by marcelobarrosalmeida View Post
Installer is normally started but it fails with the message: "The installation was canceled". I tried to close my application just after calling open_standalone as well. Same result and message, unfortunately.

Documentation statement: "The handler application is started in its own process". So, what happened ?
This is just a guess, but maybe there are some files held open, so that the installer cannot delete something it needs to. It is hard to tell.
Reply With Quote

#10 Old Re: Check for update feature - how to implement - 2008-12-08, 13:25

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by jethro.fn View Post
This is just a guess, but maybe there are some files held open, so that the installer cannot delete something it needs to. It is hard to tell.
Yes, please try to close the files before the calling the open_standlone() function, just let the default script running and see what happens


BR,

Rafael.
Reply With Quote

#11 Old Re: Check for update feature - how to implement - 2008-12-08, 14:04

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Hum... But I dont have any file opened (at least I think that I dont have !). The job is done by urllib:

urllib.urlretrieve( file_url, local_file )

The code is here:

http://code.google.com/p/wordmobi/so...rdmobi.py#1063
Reply With Quote

#12 Old Re: Check for update feature - how to implement - 2008-12-08, 14:58

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
I did two more tests:

1) I generated a html file, put the download link inside it and tried to call open() and open_standalone() using this file.

open() => browser opens but installation fails (as expected and discussed here)

open_standalone() => browser does not open but file remains open(). So, I think it was started but its window does not show up.

Reply With Quote

#13 Old Re: Check for update feature - how to implement - 2008-12-09, 07:38

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
It can very well be that you cannot start the installer from the application that is about to be updated. Some resource is kept allocated by the application (even if using open_standalone() and closing the application afterwards), causing the installer to terminate.
Reply With Quote

#14 Old Re: Check for update feature - how to implement - 2008-12-09, 12:49

Join Date: Nov 2007
Posts: 318
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Yes, I agree ... And it is related to the interpreter, in my opinion. So, talking about the other option, I mean, running an update agent, I would like to know some details:

* I read about mergesis and I think it is easy to concatenate the application and the update agent. But, how can I run this update agent from my application ? Is there any kind of launcher ?
Reply With Quote

#15 Old Re: Check for update feature - how to implement - 2008-12-09, 14:25

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by marcelobarrosalmeida View Post
But, how can I run this update agent from my application ? Is there any kind of launcher ?
Each PyS60 application has a small EXE stub ("launcher") in \sys\bin. You can run that with e32.start_exe(). To find out what the stub is called, install SISInfo and unpack an Ensymble-generated SIS file to see what's inside.

Remember that the user may install the SIS file in the internal memory or on a memory card. You can limit the installation with the --drive option to the py2sis command of Ensymble, but the PyS60 runtime may have been installed in another drive. This can cause application startup problems. Maybe the best way is to try to run the agent from the same drive your application is installed in.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
howto check what feature pack is in phone miikkis General Symbian C++ 2 2008-09-05 11:40
Check List. fmhunter Mobile Java Tools & SDKs 2 2005-08-06 20:38
6310i voice dialing feature with Headset lubaru Bluetooth Technology 1 2003-02-27 06:09
SMS Msg using VB Application gurup83 General Messaging 2 2002-07-11 05:48
WML feature 'accesskey' cschlaep Browsing and Mark-ups 1 2002-05-13 10:41

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia