Tuesday, June 13, 2006

How to create a launcher for FlashLite movies on Symbian 3rd Edition

I hope the long title is clear enough about what I'm going to discuss :-)

Symbian 3rd edition introduces several changes compared to the previous versions; I'll try to be concise as possible in order to describe the procedure to build a native ( C++ ) application whose only task is to launch the FlashLite player with a specified content.

The prerequisities to build the application are:
  • Symbian 3rd Edition SDK;
  • ActivePerl;
  • Java JRE 1.4.1;
  • Carbide.vs 2.0.1 ( VS.NET Plugin provided by Nokia);
  • Microsoft VS.NET;
The last two items are not mandatory, but at the moment are my preferred IDE ( waiting for Carbide...)

I'll break the discussion into steps:
  1. How to create the skeleton of the launcher using the wizard of VS.NET
  2. How to add/modify icons to the application
  3. How to launch the FlashLite Player with content
  4. How to create the SIS file to install the app.
Let's start!
Step 1:
Launch MS Vs.NET and create a new Symbian Project. Select Symbian 9 as Project type; S60 simple Hello World Application as Project template; S60 3.0 as SDK to build against.
If your SDK is not visible, click on Enable/Disable SDKs button.

The wizard creates a bunch of files.
The .rls file includes the caption strings that are displayed in the Menu aplication of S60 phone:

//d:Caption string for app.
rls_string qtn_hewb_caption_string "launcher"

//d:Short caption string for app.
rls_string qtn_hewb_short_caption_string "launcher"

Step 2:

The application at this moment has a default icon (qgn_menu.svg) in SVG format located in gfx folder.
Symbian 3rd Ed supports vectorial graphics (in addition to bitmap images) to render images to different display resolutions. Remember that S60 devices supporting Symbian 3rd Ed comes with a pletora of resolutions (176*206px; 240*320px; 352*416px); so bitmap icon optimized for a device could appear blocky or strechted in different resolution.

To modify the icons file, right click into the Solution panel the .miflist file and select Edit multiicon definition.

In this example I changed the default with a bmp file, shuttle.bmp.

Here it is the final result:
The procedure to add a svg icon is the same. Remember to replace and not to simply add the new icon because Symbian uses a index-based mechanism to retrieve the resources.

Step 3:

Now it's time to add the code to launch the player....don't be scared, it's just a few lines ;-)
Open <yourapplicationappui.cpp> file (in this case, launcherappui.cpp), and substitute the ConstructL() method with the following one

void ::ConstructL()
{
// Initialise app UI with standard value.
BaseConstructL();

RApaLsSession session;
session.Connect();
TFileName fullpath;


RFs fsSession;
fsSession.Connect();
fsSession.PrivatePath( fullpath );
fullpath.Append(KMyfileName);
fsSession.Close();

TThreadId id;
TInt err = session.StartDocument(fullpath,/* KUidFlash2App ,*/ id);

session.Close();
User::Exit(0);

}

Add this lines to the top of the file:

#include APGCLI.H
#include aknutils.h
_LIT(KMyfileName,"myflashfile.swf");//your swf file name

In the Solution Panel, right click on the solution name; select Properties -> Linker -> Input -> Additional dependecies; add apgrfx.lib to the list of libraries.

The launcher opens Flash player with myflashfile.swf as argument and then close itself.
The swf is located in the private
folder of the launcher, so only the launcher can access to that folder.


(To be continued)
......Next time I'll write how to pack those files into a sis file.


7 Comments:

At 1:39 PM, Anonymous Anonymous said...

Ciao Fabrizio,

thanks a lot, I will try it today to make it work

Alessandro

 
At 3:09 PM, Anonymous Anonymous said...

Ciao fabrizio,

I tried to compile the code with Carbide but I am getting the following error:

Severity Description Resource In Folder Location Creation Time Id
2 undefined identifier 'BaseConstructL' launchswfAppUi.cpp launchswf/src line 41

any ideas?
Alessandro

 
At 4:11 PM, Blogger Fabrizio said...

Ciao,

the problem could be the #include directives.
Insert <> brackets...

In addition, check the definition of ConstructL:

void CLaunchswfAppUi::ConstructL()
{
....
}
in my post I missed the classname before "::"

HTH

 
At 4:19 PM, Anonymous Anonymous said...

Ciao Fabrizio,

got the those changes into the files but the .exe is not been created:

Severity Description Resource In Folder Location Creation Time Id
2 Undefined symbol: 'ClaunchswfAppUi::ClaunchswfAppUi(void) (??0ClaunchswfAppUi@@QAE@XZ)' referenced from 'class CEikAppUi * ClaunchswfDocument::CreateAppUiL(void) (?CreateAppUiL@ClaunchswfDocument@@UAEPAVCEikAppUi@@XZ)' in launchswfDocument.cpp:86 launchswf line 0

 
At 4:27 PM, Blogger Fabrizio said...

Ale,

this is a link error...you need to add the library I mention. Don't know where is the right place in Carbide

 
At 1:01 PM, Anonymous Anonymous said...

Hi,
Will I be able to launch and keep active multiple instances of the flash player using this method?

Thanks,
Amelie

 
At 1:05 PM, Blogger Fabrizio said...

Sorry but it's not possible to have multiple running instances of Flash Player

 

Post a Comment

<< Home