Thursday, March 29, 2007

dealing with fscommand launch

If you've ever wanted to use Flash Lite to communicate with C++ then fscommand("Launch",application) is a very useful feature. Its purpose is to allow you to launch an application on the phone and pass in addional command line parameters if necessary. So you could for example launch the browser and pass in a web address. Thats a basic example and there are other ways of doing that with getURL(). The real value in the launch fscommand is that it allows you to launch your own C++ application in the background to support your Flash Lite application.

In a recent Flash Lite project where we needed to use fscommand("Launch",app)
we came up against a few issues when it came to s60 3rd edition phones. So heres a summary of things to consider when using fscommand("launch").

You will probably have to call fscommand("launch") from a button press as it needs to be a user initiated action.

For 3rd Edition phones, because of the way applications are accessed you do not give an actual path to the application. So if I wanted to open the browser I would just do the following:

fscommand("Launch", "browser.exe");


For 2nd Edition phones you have to give the full path to the executable file. So for example:

fscommand("launch", "z:\\system\\apps\\browser\\browser.app");


Passing in arguments works the same across s60 3rd and 2nd edtion devices by putting the arguments after the application. eg.


For 2nd edition: fscommand("launch", "z:\\system\\apps\\browser\\browser.app,http://bbc.co.uk");


For 3rd edition: fscommand("launch", "browser.exe,http://bbc.co.uk");


However we were unable to read the arguments for our custom application. So it maybe that because of the security of the 3rd edition only the native applications such as browser can accept incoming arguments?


When it comes 2 way communication between Flash Lite and other applications the more effective way to do this is by running a local server on the device and then using loadVariables or even XMLsocket to talk to the native app. Although theres no point having a local server listen out for FL calls if FL isn't even running. So fscommand is again crucial here as a the starting point of communication.

Labels: , ,

8 Comments:

Blogger Leonardo said...

Hi Nick,

it's strange that you can't receive arguments from flash lite (3rd edition)... basically if browser.exe app can do it, in the same way should be possible for your app..

However I think the best way to accomplish communication is a local http server (because I've found some issues with xmlSocket)

what do u think about?

Leonardo

12:42 PM  
Blogger Ugur said...

We believe there is a bug with launch command. No obvious reason why it shouldn't execute any other 3rd party application. Server is not the easiest solution, but apparently only solution left for communication.

2:04 PM  
Blogger Nick Gerig said...

Hi Leonardo

The only theory we had about the arguments thing was that because our app didn't have a UI it was trying to read the arguments using a different library than a UI based app would. We didn't have time to investigate too much unfortunately.

Agree local http server seems the most stable and resource efficient way to go. Socket is great but might be some issues with it, in particular I think that having a local xmlsocket open and talking to a remote server through locadVars at the same time is not that stable. Maybe because they use the same connection there is room for confilct?

Cheers

Nick

3:15 PM  
Blogger Nick Gerig said...

Hi Ugur,

We didn't finding any problem with executing the application.I take it you mean a bug sending arguments?

In which case yeah I think we concluded after way to much work investigating that its a bug :)


Cheers


Nick

3:18 PM  
Blogger belasito said...

Hi,

I was very glad to find your post, after many hours of research on the web. There seems to be very few info regarding the use of the browser, camera, ... with flash lite.

Now, as a student, I have to make a project and do research on Flash Lite. I already managed to start the camera, but is it possible to get the picture back into the flash lite app? Could someone help me out here?

2:13 PM  
Blogger tmarbois said...

yea were trying to get video capture back to another app for uploads....anyone had any success in using fscommand and some server on device to launch camera into video mode - capture video - then return to app or flashlite for upload?

3:29 PM  
Blogger Henry said...

Hi Nick,

I've found that sending the browser arguments from flash can be problematic (on s60 3rd edition, feature pack one) - the browser launches, loads the page, and then displays the bookmarks window, so it looks as though nothings really happened.

I've also found that if the app that's being launched by flash is a python script wrapped in a sis using ensymble, the app seems to start and then crash immediately - very frustrating.

Any thoughts (apart from 'learn C++' of course...)

cheers

Henry

11:14 PM  

Post a Comment

<< Home