How to: write a Flash Lite 2.1 launcher
There was a lot of posts and discussions about the missing of a recognizer for Flash Lite 2.1 public player. Adobe team didn’t include it with the player to avoid confusion on which player should be launched when there are more than one player installed (embedded and downloadable version) at the same time on the same device.
The result is that the normal way of launching a specific document in Symbian can’t be used to launch Flash Lite 2.1 content. However it’s possible to go around the problem and write a Symbian launcher for such type of applications. For doing that it’s necessary to have our application symbian signed because we must use TApaTask class, and in particular SwitchOpenFile method which requires SwEvent capability.
I don’t post here the complete solution, but only the code snippet necessary to do the trick (the missing steps are relatively easy). What we have to do is to start the Flash Lite 2.1 from the symbian launcher, wait in some way for the splash animation to finish (I didn’t find a way to stop it), therefore call something like this:
TUid KUidFlash21 = { 0×200077D6 }; //FlashPlayer 2.1 UID
RApaLsSession ls;
User::LeaveIfError(ls.Connect());
TInt KError = ls.GetAppInfo(appinfo, KUidFlash21);
CleanupClosePushL(ls);
{
//Search for open player
TFileName fnAppPath = appinfo.iFullName;
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( KUidFlash21 );if( task.Exists()) //If player is already running
{
TInt err = task.SwitchOpenFile( KLitSwfFileToLaunch );
if(err == KErrNone)
{
//everything is fine
} else {
//any error
}
task.BringToForeground();
} else {
if(KError == KErrNone) //the player is not running so we launch it
{
CApaCommandLine* cmd = CApaCommandLine::NewLC();
cmd->SetExecutableNameL( fnAppPath );
cmd->SetDocumentNameL( KLitSwfFileToLaunch );
cmd->SetCommandL( EApaCommandOpen );
TInt result = ls.StartApp(*cmd);
if (result!=KErrNone)
{
//any error
} else {
//Now we can wait for the splashscreen movie to finish in
//order to call SwitchOpenFile method..
}
CleanupStack::PopAndDestroy(); // Destroy cmd
}
}} else {
//FlashPlayer not installed
}
CleanupStack::PopAndDestroy(); // Destroy ls
I hope this can be helpful. All comments, suggestions and corrections are appreciated.
THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
update: I’ve compiled and tested the code for Symbian 9.x, but with a few changes it can be used also for previous symbian versions.
Posted: February 27th, 2007 under flash lite, symbian, MY STUFF.
Comments: 20
Comments
Comment from byte.sm
Time: February 27, 2007, 3:52 pm
ciao Alessandro,
the application must be symbian signed :(
Leonardo
Comment from Abdul Qabiz
Time: February 27, 2007, 5:26 pm
Thanks for code. I have been spending sometime to write launcher for S60V2FP3 devices. But I have not been successful launching SWFs. I event wrote recognizer, but it seems it screwed .mp3 association on my device :)
Would try if this code works for S60V2FP3 by using some equivalent old APIs?
Comment from byte.sm
Time: February 27, 2007, 5:32 pm
Hi, TApaTask class is the same even for S60V2FP3, so it could work as well…
Pingback from BlocketPc » Lanzador de aplicaciones Flash Lite 2.1
Time: February 27, 2007, 5:45 pm
[…] Tutorial sobre lanzadores de SWFs Lanzador de aplicaciones Flash Lite 2.1 […]
Comment from Abdul Qabiz
Time: February 27, 2007, 6:31 pm
Yeah it’s working fine. I am implementing logic where I want to open SWF once splash animation is over.
I am using CPeriodic for that? Is it ok or should I use some other timer?
I would post the code, once I am done.
-abdul
Comment from byte.sm
Time: February 27, 2007, 6:49 pm
hi Abdul,
CPeriodic is fine ;)
tell us when you are done!
Comment from Abdul Qabiz
Time: February 27, 2007, 10:14 pm
It worked, I am cleaning code and would post it.
BTW! It seems you can terminate splash-animation by sending RIGHT_SOFT_KEY?
-abdul
Comment from byte.sm
Time: February 27, 2007, 10:49 pm
yes, it’s true… in theory you can send the key event via code. but if you send it too early the risk is to close the player..
Comment from Abdul Qabiz
Time: February 28, 2007, 12:00 am
I just posted the code here, http://www.abdulqabiz.com/../flashlite_21_launche.php
It’s not very neat and clean. I would be working on this to find better way, I am sure there would be some way to directly pass params to player..
-abdul
Comment from byte.sm
Time: February 28, 2007, 12:28 am
yes, it’s almost a dirty trick.. but I’ve tried to pass document name as parameter to the player in several ways without success.
I achieved this solution after seeing that it’s very similar to the one adopted by symbian for amigo application..
I hope you can find a cleaner way! I think Adobe with Flash Lite 3 could introduce a better way of integration with external code (some sort of API set)
Pingback from FlashLite 2.1 Launcher for Series 60 2nd edition at I2fly
Time: February 28, 2007, 5:36 am
[…] Abdul modified Leonardo Risuleo to work on Series 60 2nd edition (not tested on all). Also added functionality where SWF would be opened after some delay, because FlashLite player takes around 6-7 seconds to show splash-animation. […]
Comment from Abdul Qabiz
Time: February 28, 2007, 1:47 pm
> I achieved this solution after seeing that it’s very similar to the
> one adopted by symbian for amigo application..
Same here, I have been wondering how Nokia’s S60 tutorial app works.. It’s basically you hide the player and keep showing your window…later just switch views?
-abdul
Comment from byte.sm
Time: March 2, 2007, 10:22 pm
hi Abdul,
Nokia’s s60 tutorial app is devloped in Flash Lite 1.1 (with proper recognizer), so no more workaround are needed ;)
Leonardo
Comment from up2U
Time: March 4, 2007, 11:32 am
this seems to be a big break through!
Comment from Pete Thomas
Time: March 8, 2007, 7:08 pm
Is there anyway to get this working for development purposes without sending to Symbian for signing or am I missing something?
Comment from byte.sm
Time: March 8, 2007, 7:23 pm
the application must be symbian signed :( (as far as I know)
the function requires SwEvent capability
Comment from tv izle
Time: March 22, 2007, 10:35 pm
the application must be symbian signed
Comment from jackdavid
Time: April 3, 2007, 6:49 am
yes i also agree with your points it must be signed.
Comment from byte.sm
Time: July 9, 2007, 11:04 pm
UPDATE: this code is not the perfect solution, you can find a better solution here: http://www.scriptamanentgroup.net/byte/?p=186
Cheers,
Leonardo


















Comment from Alessandro
Time: February 27, 2007, 3:12 pm
Ciao Leonardo,
does it required to be symbian signed or it’s enough to self sign?
Alessandro