SWF3SIS - The journey so far

Summary:

This post is the chronicle of my journey into S60 9.x or Nokia 3rd edition development from a Flash Lite developers perspective. In this epic post I show how I have gone about creating a .sis file with the intention of having it signed together with the development of a native C++ .exe which launches my .swf file (my Flash Lite application) from an icon in the mobile phone menu. This is not intended to be the definitive answer, more a documentation of my personal holy grail.

Okay so for a while now we’ve all been developing Flash Lite apps, and the first major hurdle was, duh no pre-installed players. That was fine we were able to buy a player and install it onto our 60 series Nokias, develop some cool content and test it on our phone. And back in the good old days, when we had absolutely no idea when ‘pre-installed’ phones were going to hit the shelves, we were able to use the lovely swf2sis from those nice guys from Blue Sky North So we had cool installable content and no phones to send the content to without trying to convince end users to go off to Adobe Store and buy the player for £6.

Now nearly two years later there are so many Flash Lite pre-installed mobile devices that I’m personally having trouble keeping up, and everything should be just rosie, shouldn’t it? Hmm not quite, as now Symbian have moved the goal posts on signing applications, which is fine if it means my N91 isn’t going to get riddled with smallpox. What I have found to be a major pain is that, to a designer developer like myself, the whole process is a perceived nightmare. This means we’ve now got the reverse, lots of smashing content, lots of devices capable of playing our content ’straight out of the box’ and absolutely no idea how to get the two together*. Hopefully this, my very first tutorial should help you take your Flash Lite content and package it into a nice neat signed and distributable, S60 application.
(*let’s ignore BREW for the time being, as I’m in the UK and just jealous)

How to package, sign and get your Flash Lite content tested for commercial distribution.

First off here’s a shopping list of application you are going to need and joy of joys they’re all free.

NB Download and install in this order

1, Active Perl 5.6.1 build 631
2, Java Runtime version 1.4.1_02
3, Carbide C++ EXpress
4, S60 Platform SDK for symbian OS C++ Choose S60 3rd Edition SDK for Symbian OS, for C++ (262MB)

(Edit) This is now 3rd edition FP1

Now go over to VeriSign and apply for your ACS Publishers ID, this will take a day or two to get back to you and may require a signed letter from a Notary (as in my case and should be sorted by within a couple more days) The ACS ID will cost £185 or $350 and will last a year.

No go over to Symbian Signed and register yourself there, part of the application form asks for your ACS ID, if you have it cool, I didn’t and I’m asuming I can add it later. Once you have an account you need to “Request UID’s” these are the unique numbers which will be allocated to your application.

As this application is going to be signed click ‘protected range’, Fill in the details here the UID’s for your UID can now be seen by clicking “View UID’s”.

Signing S60 .sis files requires:

  • a .sis
  • a certificate file *.cer
  • and a key file *.key

First of all we get our certificate from Symbian Signed website, click Developer Certificates from here you can download the ‘DevCertRequest‘ tool. Once downloaded, install the tool and run it, you are asked a series of questions:

  1. Browse to, or enter the location you want to create your csr file in ie ‘C:\carbideDev\certs\pocketflash.csr’ click next
  2. Key File Information - if you have an ACS pub ID then this is where it gets used, I don’t so for the time being I’ll click no and again browse or enter the location you want to create your *.key file ie ‘C:\carbideDev\certs\pocketFlashKey.key’ below this input box it requires a ‘private key file password’ and asks to verify this I entered ‘flash’ but you can use something a little more ‘password like’ click next.
  3. Personal Information - as it sounds file in as appropriate my I used ‘pocket marketing’ as my common name. click next.
  4. Phone and capabilities - As this is a developers certificate it is locked to one phone and requires it’s IEMI number, which can be found by pressing *#06# on your phone, enter it in here. You are also asked to add the capabilities you will require, I’ll be honest with you here I’m not sure what you need so I added them all. Click next / Finish and you should now have your very own developer certificate and key ‘pocketFlash.csr’ and ‘pocketFlashKey.key’

Now back to Symbiansigned.com and click ‘Request DevCert’ (make sure you log in to see this in the menu) browse to your *.csr file in my case ‘C:\carbideDev\certs\pockflash.csr’ and click send.

After a minute or two you can click ‘View DevCerts’ where your certificate will appear click download and save it into the folder with your *.csr file and your *.key file

Now lets open Carbide

File > New > C++ Application for S60 Project

Enter the name of your project eg ‘pocketflash’
The most important tip I have about Carbide is this, make sure your workspace path contains NO spaces as in:

BAD

C:\Documents and Settings\gareth

I chose

GOOD

C:\carbideDev

and it works for me.

Click Next

From the templates wizard select ‘S60 3.x GUI Application and click next

Now you are asked which SDK to use, hopefully there should be a tree structure ‘All SDK’s > S60_3rd’ and below there should be two SDK’s ‘S60 3.0 Emulator Debug’ and ‘S60 3.0 Phone (GCCE) Release’ make sure both are checked and click next

Here you are asked for your basic properties, you will now need your UID which will look something like 0×20000000 from symbian signed (click view UID’s)

Author - ‘Gareth Evans’

Copyright notice - ‘Copyright Pocket Marketing, all rights reserved’

Text to be shown - ‘pocketflash’

Click next

Directories - leave as defaults and click finish

You now have a directory structure for a default S60 GUI application, well done.

In explorer navigate to your workspace folder, in my case it’s ‘C:\carbideDev’ there you should find a new folder for this project again mine’s called ‘pocketflash’ inside it there should be a folder called sis, this is where you need to put your *.swf file. eg ‘C:\carbideDev\sis\pocketflash.swf’

Creating a Menu Icon

The initial setup wizard also creates a default icon here ‘C:\carbideDev\pocketflash\gfx\qgn_menu_pocketflash.svg’

Open this in an editor that is capable of saving out .svg file formats (I used Illustrator) from here you can delete the default icon generate your own, save and close the file.

Now back into Carbide

Click ‘Project’ from the top menu bars and down to ‘properties’ on the left of the properties panel click ‘C/C++ Build’ and change the ‘Configuration type’ from ‘S60 3.0 Emulator Debug’ and ‘S60 3.0 Phone (GCCE) Release’

The menu in the middle of the panel should refresh, under the option ‘CreateSis (installation File Generation)’ click ‘general options’. On the right hand side there should be a new this is where we add our certificate and key files that we created with our ‘DevCertRequest’ tool earlier. Add your passphrase in here, mine was ‘flash’ and then browser to your *.cer and .key files respectively. Now add the name you want to call you signed .sis file I called mine ‘pocketflashsigned.sis’.

While we in the properties window, again under the central ‘Tool Settings’ panel, underneath ‘GCCE Linker’ select ‘Libraries’.

Now on the right hand side, there is a panel titled Libraries. Click the Green Plus icon and enter ‘${EPOC32_RELEASE_ROOT}\ARMV5\LIB\apmime.dso’ click Okay.
Click the green plus icon again and this time enter ‘${EPOC32_RELEASE_ROOT}\ARMV5\LIB\apgrfx.dso’ (without the quote marks) click okay and apply then okay which should take you back the main carbide window.

On the left handside, there should be a ‘Navigation’ panel, if not click ‘Window > Show view > Navigation’. This show a directory tree for your project(s).

Click the plus symbol next to your project to expand the tree, from here there are a list of directories that make up your application.

Click the plus symbol next to the ’sis’ directory and then double click on the file with the .pkg extension eg ‘pocketflash.pkg’.

At the end of this file we will add one line of code that will break down into two sections:

  • The local path to the .swf file you want to package.
  • And the directory structure you want to create on the device.

eg, ALL ON ONE LINE, INCLUDING THE QUOTE MARKS
“C:\carbideDev\pocketflash\sis\pocketflash.swf” -”!:\pocketflash\pocketflash.swf”

Save and close the .pkg file

Now click the plus symbol next to the ’src’ folder icon, now we can see it’s contents, double-click to open the file that ends ‘AppUi.cpp’ eg ‘pocketflashAppUi.cpp’

This is where we will enter the code that opens our .swf file.

NB. THIS CODE IS AS-IS, ALTHOUGH I’VE COMPILED AND TESTED IT ON MY DEVICE I CANNOT GUARANTEE THAT I HAVEN’T OVERLOOKED OR COMPLETELY MISSED SOMETHING WHICH MAY BE DEEMED IMPORTANT.

What I can say is this, I fully intend to get this checked out by someone who know’s a lot more about C++ for S60 than I do, and as soon as that happens I’ll post any amendments here.

Onto the code:

In the pocketAppUi.cpp file find the line:

// INCLUDE FILES

And add these two lines

#include <apgcli.h>
#include <aknutils.h>

Add these two lines below all if the include calls
_LIT(KFile, “\pocketflash\pocketflash.swf”);
TFileName aFileName(KFile());

Now we nee to change the ‘ConstructL()‘ function

My function looks like this:

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

// Create view object
iAppView = CpocketflashAppView::NewL( ClientRect() );

// Create a file to write the text to
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL( fsSession );

TInt err = fsSession.MkDirAll(KFileName);
if ( KErrNone != err )
{
CleanupStack::PopAndDestroy(1); // fsSession
return;
}

RFile file;
err = file.Replace(fsSession, KFileName, EFileWrite );
CleanupClosePushL( file );
if ( KErrNone != err )
{
CleanupStack::PopAndDestroy(2); // file, fsSession
return;
}

RFileWriteStream outputFileStream( file );
CleanupClosePushL( outputFileStream );
outputFileStream << KText;

CleanupStack::PopAndDestroy(3); // outputFileStream, file, fsSession

}

//Replace the whole function with this

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

CompleteWithAppPath(aFileName);

//start of my code trials
RApaLsSession session;
session.Connect();

// Gets the UID and MIME type for the given file name.
TUid uid;
TDataType dataType;
session.AppForDocument(aFileName, uid, dataType);

// Runs the default application using the MIME type, dataType.
// You can also use the UID to run the application.
TThreadId threadId;
User::LeaveIfError(session.StartDocument(aFileName, dataType, threadId));

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

}

Remember to change the first line

void CpocketflashAppUi::ConstructL()

to

void CYOURAPPNAMEHEREAppUi::ConstructL()

There is one more line of code you need to change in this file, which can be found ‘around line 130, give or take’

User::LeaveIfError(rFile.Open(fsSession,KFileName, EFileStreamText));//EFileShareReadersOnly));// EFileStreamText));

Change ‘KFileName‘ to ‘aFileName

Save this file and close it

Okay nearly there, in the main menu click ‘Project > Build Project’

Give Carbide a minute or two to do it’s thing and then check inside your ’sis’ folder where you should now find your shinny new pocketflash.sis file.If for some reason it’s not there Carbide comes with ‘problems and console’ windows at the bottom part of the applicaton, which makes debuggin a bit easier. Check over everything and try again, this time instead of clicking ‘Project > Build Project’ choose ‘Project > Clean’ check the box entitled ‘Clean projects selected below’ and tick your project. Click okay and hopefully everything should work and give you your .sis file.

I personally use nokia application installer to get it onto my N91 but you can use whatever you like, run the installer and and launch your application, which will now be placed inside the ‘My Own’ folder.

As I haven’t received my AC Publishers ID as yet I haven’t had my application signed, as far as I am aware once this has gone through I can download another *.cer and *.key pair and replace the developer pair I’ve used in this tutorial.

Once I’ve re-compiled the .sis in carbide the .sis is sent to a testing house (see test houses on Symbiansigned.com for more info) to be tested. This is the theory anyway, as soon as I’ve put this into practice I’ll be updating here.

3 Responses to “SWF3SIS - The journey so far”

  1. Pocket Flash » Blog Archive » Q. When is passive content not passive content? Says:

    […] Pocket Flash Pocket Marketing’s Mobile Development « SWF3SIS - The journey so far […]

  2. hpimentel Says:

    Hello,
    I Try to download 3, Carbide C++ EXpress 4, S60 Platform SDK for symbian OS C++ C as you supply in this blog but I receved the flowing error from forum.nokia.com (atfer registraton and login):

    Download Failure

    Request information:

    Request ID: 180920
    URI: http://sw.nokia.com/id/178ab2d1-b59d-4236-96e6-215ae212c223/S60-SDK-200634-3.1-Cpp-f.1090b.zip
    Error Message: Downloader’s country group below file’s required rating (ADCG)! Required: B, downloader’s: D

    Your download could not be completed. Please try again later. If the problem persists, please send feedback.

    When reporting errors to us please let us know also these details:

    * name or the URI of the file you were trying to download,
    * exact date and time for downloading,
    * your country and city,
    * your IP address,
    * browser you are using and the version number,
    * request ID above
    * URL of this error page and the error message above and
    * if you are using a download manager (which one).

    This information will help us in solving the problem.

  3. gareth Says:

    Hi I’ve updated the link, and it’s now pointing to 3rd edition FP (feature pack) 1

    I hope this helps

    Cheers

    ps sorry for the delay, I’ve had some well deserved time off and manage to through the 70 items of spammed comments

Leave a Reply