Symbian OS
read last symbian news on www.newlc.com read last symbian reviews on www.newlc.com
read last symbian tutorial on www.newlc.com read last symbian download on www.newlc.com
1 Jun 2007 - 11:16

There are several ways to autostart your application at phone boot. Unfortunately, none of them is universal and you will have to use at least two of the four APIs described in this tutorial: the recognizer, the Symbian "Start-On-Boot" API, the Nokia Startup List API and the SonyEricsson AutoStarter API.

Recognizer


Recognizers are the usual way of autostarting an application on devices based on S60 1st and 2nd edition and UIQ v2. This is however not their primary purpose, as they are part of the content handling framework.

Writing a recognizer is fairly easy and documented. As an example, you can get our own source code taken out of a more packaged boot utility called EzBoot.

Important Point


  • You must be aware that, while the code is rather simple, a badly written recognizer can totally lock a device unless you know the "disable recognizer shortcut" (boot the phone while pressing the pencil key on S60 phones).
  • Recognizer are started quite early during the phone boot process and some service might not be available when your application is started. As an example, your application will be started before the user has entered its PIN code. Which mean that you won't be able to access the network or most of the SIM and user data unless you write your own waiting mechanism (note that EZBoot does that for you and ensure that the phone has completely started before lauching your application).
  • Recognizers can't be used anymore to boot an application on S60 3rd Edition FP1.

Symbian Start-On-Boot API


The Symbian Start-On-Boot is a recognizer packaged by Symbian Ltd. This API is compatible with all version of Symbian OS from 6.1 to 8.0a (and thus the S60 v1,v2 and UIQ v2 platforms).

The package contains SIS file, binaries and header file so that you can use it in a test environment or integrate it into your application.

1. Register your executable with the service


Registering an exe with this service mainly consist in calling the RServiceStartOnBoot::AddServiceL() primitive giving the full path to your exe file:

RServiceStartOnBoot sob;
sob.CreateL();
CleanupClosePushL(sob);
sob.AddServiceL(_L("\\<pathtoyourexe>\\programToStart.exe"));
CleanupStack::PopAndDestroy();

2. Add the binaries to your PKG file


Add the following line at the end of your PKG file (here assuming that you are working with S60 v2 target and that the SIS file containing the API is in the same directory as your pkg file):

@"exestartonboot_s60v2_0_SymbianSigned.sis",(0x????)

The value of ???? must reflect the UID of the SIS file.

Important Point


Here are a few important points:
  • The service will be started approximatively 1 minute after the phone has started.
  • The service will be automatically removed from the start service if the phone reboots within 3 minutes of the startup following the installation of the service (or if the user do reboot his phone).
  • Only EXE files (thus no application) can be started using this API

Nokia Startup List API


The Startup List API has been introduced in S60 3rd Edition and is the standard way to start your application on these devices. The advantage of this API is that this is a standard and documented API which is now part of the S60 platform. No dirty trick inside.

Here is how to use it.

1. Create a boot resource file


The first step is to create a specific resource file that will contain the boot information. You have not many option in this file. Call it yyyy.rss where yyyy is the UID3 of the executable to start:

#include <startupitem.rh>
 
RESOURCE STARTUP_ITEM_INFO startexe
{
    executable_name = "\\sys\\bin\\programToStart.exe";
    recovery = EStartupItemExPolicyNone;
}

You are not dumb so replace the name programToStart.exe by the name of your executable file. You currently don't have any other option as the executable must reside in the \sys\bin\ directory and the recovery parameter cannot take any other value than the one described (this is valid up to S60 FP1 and future version may introduce further values).

I usually write this file in a Data directory where resides all my other resource files. Put you can put it wherever you want. The Group directory is another good option if you prefer.

2. Update your MMP file


The resource file described above shall now be added to the compilation process. To do so, you have to update your MMP file with the lines below:
SOURCEPATH      ..\data
START RESOURCE yyyy.rss
END

The SOURCEPATH line contain the relative or absolute path to the rss file. At this point, user of Nokia Codewarrior will have to reimport their project so that the change in the MMP file is correctly taken into account.

3. Update your PKG file


And finally you also have to edit your PKG file so that the compiled boot resource is written on device:

"\epoc32\data\yyyy.rsc"- "c:\private\101f875a\import\[yyyy].rsc"

Also check that the UID3 of the package must match the yyyy value:

#{"My Application Name"},(0xyyyy),1,00,0

Important Points


Some important points here:
  • the resource file is compiled as yyyy.rsc (or yyyy.r01,yyyy.r02,etc...) for a multilingual application and must be installed with additional square brackets in its name, here [yyyy].rsc.
  • the resource file must be installed on the c: drive, no matter where your application is located. If not, it will be ignored during the boot sequence.
  • the application must be signed with a valid developer certificate (or Symbian Signed). Applications signed with a self generated certificate cannot use this API.
  • the started executable must run for at least 6 seconds or a warning message will be shown to the user: Unable to start programToStart.exe. Application may need to be removed.

Note that the second point is an acceptable exception to the Symbian Signed test criteria PKG-03 ("File Creation Location"), see EX-006 ("Small Files for Maintaining Configuration and Settings Information, or which the System creates").

SonyEricsson AutoStarter API


The SonyEricsson Application Startup API is not documented anywhere - or at least I did not found any official descriptive information about it, just this thread on our forums.

This is however a working trick to have your application auto-started on SonyEricsson phones - at least those running UIQ 3.0 platform. I have no information whether this will be supported by the upcoming Motorola UIQ based phones nor any future phone.

1. Create the AST file


This API is relatively simple to use. First, create a text file, named programToStart.ast, containing the name of the executable to start, with no path information:

programToStart.exe

2. Update your PKG file


Then update your pkg file with the following line at its end:

"..\data\programToStart.ast"-"!:\private\10274b9f\import\programToStart.ast"

Important Points


  • The AST file must be made of a single line with just the executable name and no CR/LF at its end.
  • Your application must have the WriteUserData capability
  • Unlike other methods, this API won't start your exe directly after installation.

References


Tutorial posted June 1st, 2007 by eric

Submitted by Kibi on Tue, 2007-06-05 09:47.

Any way to autostart in UIQ 3?

--
Kibi
Give me immortality - or give me death!


Submitted by eric on Tue, 2007-06-05 11:07.

Updated with UIQ3 information.


Submitted by gameryf112 on Fri, 2007-06-08 05:38.

the "AST file" way is not work on the lastest UIQ3 fireware.


Submitted by eric on Fri, 2007-06-08 16:33.

Which latest firmware are you referring to ? It works perfectly on my M600i which has been updated yesterday (with Organizer firmware CXC 162071 R6A16). And this is the latest one as far as I know.


Submitted by gameryf112 on Fri, 2007-06-08 18:46.

ECOM-recognizers is the right way, I think.(actually it is the only solution pass my test on a prototype SE phone,well,I think it should be called next-gen M600)

someone from UIQ said:
" Beware that the unsupported solution that leaked out based on some internal Sony Ericsson APIs does not work on the recent firmware of their UIQ 3 phones, which is exactly why it was not publicised in the first place"

check this out:
http://developer.uiq.com/forum/click.jspa?searchID=84143&messageID=4341


Submitted by dracula on Mon, 2007-06-25 09:50.

In our S60 2nd application we used EZBoot, and had an option that allowed the user to enable/disable autostart (by creating/removing the .boot file).

Would it still be possible to change autostart behaviour from within our application when using the Nokia Startup List API in S60 3rd?


Submitted by mplayer.mmboy on Tue, 2007-06-26 10:21.

What function do i need to use for SE P990i ?

I tested with the MySpy program from SE but it not work with ast file. Sad
What is the " WriteUserData " capability ?
What i need to do for it?

Any link or info for p990i . Puzzled

With Thanks


Submitted by arsubahan on Wed, 2008-07-16 20:38.

Dear Sir,

I have read manu article with regards to autostart application at boot up, but I still not able to start my program at boot up pLease if
somene can assis me. The following is my code.

AT my UID3.rss

#include

RESOURCE STARTUP_ITEM_INFO Epoc32Sys
{
executable_name = "C:\\sys\\bin\\Epoc32Sys.exe";
recovery = EStartupItemExPolicyNone;
}

At Epoc32sys.pkg
; Epoc32Sys.pkg
; This is an auto-generated PKG file by Carbide.
; This file uses variables specific to Carbide builds that will not work
; on command-line builds. If you want to use this generated PKG file from the
; command-line tools you will need to modify the variables with the appropriate
; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
; Also, the resource file entries should be changed to match the language
; used in the build. For example, if building for LANGUAGE_01, change the file
; extensions .rsc to .r01.
;
;Language - standard language definitions
&EN

; standard SIS file header
#{"Epoc32Sys"},(0xEBFB17E5),1,0,0

;Localised Vendor name
%{"Vendor-EN"}

;Unique Vendor name
:"A Razak Subahan"

;Supports Series 60 v 3.0
[0x101F7961], 0, 0, 0, {"Series60ProductID"}

;Files to install
;You should change the source paths to match that of your environment
;
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Epoc32Sys.exe" -"c:\sys\bin\Epoc32Sys.exe"
"$(EPOCROOT)Epoc32\data\z\resource\apps\Epoc32Sys.r01" -"c:\resource\apps\Epoc32Sys.r01"
"$(EPOCROOT)Epoc32\data\z\private\10003a3f\apps\Epoc32Sys_reg.r01" -"c:\private\10003a3f\import\apps\Epoc32Sys_reg.r01"
"$(EPOCROOT)epoc32\data\z\resource\apps\Epoc32Sys_aif.mif" -"c:\resource\apps\Epoc32Sys_aif.mif"
"$(EPOCROOT)epoc32\data\z\resource\apps\Epoc32Sys.mbm" -"c:\resource\apps\Epoc32Sys.mbm"
"$(EPOCROOT)epoc32\data\EBFB17E5.r01"- "c:\private\101f875a\import\[EBFB17E5].r01"

; Add any installation notes if applicable
;"Epoc32Sys.txt" -"c:\private\0xEBFB17E5\Epoc32Sys.txt"

At Epoc32sys.mmp

TARGET Epoc32Sys.exe
UID 0x100039CE 0xEBFB17E5
VENDORID 0
TARGETTYPE EXE
EPOCSTACKSIZE 0x5000

SYSTEMINCLUDE \epoc32\include \epoc32\include\variant \epoc32\include\ecom
USERINCLUDE ..\inc ..\data

SOURCEPATH ..\data
START RESOURCE EBFB17E5.rss
TARGETPATH \private\import\0xEBFB17E5
END

SOURCEPATH ..\data
START RESOURCE Epoc32Sys.rss
HEADER
TARGETPATH resource\apps
END //RESOURCE

START RESOURCE Epoc32Sys_reg.rss
TARGETPATH \private\10003a3f\apps
END //RESOURCE

LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib
LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib
LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib
LIBRARY etext.lib gdi.lib egul.lib insock.lib
LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib etel3rdparty.lib
LIBRARY msgs.lib smcm.lib gsmu.lib mtur.lib

LANG 01

START BITMAP Epoc32Sys.mbm
HEADER
TARGETPATH \resource\apps
SOURCEPATH ..\gfx
SOURCE c12,1 list_icon.bmp list_icon_mask.bmp
END

SOURCEPATH ..\src

#ifdef ENABLE_ABIV2_MODE
DEBUGGABLE
#endif

SOURCE Epoc32SysContainer.cpp Epoc32SysContainerView.cpp Epoc32SysDocument.cpp Epoc32SysApplication.cpp Epoc32SysAppUi.cpp SMShandler.cpp SystemManager.cpp

CAPABILITY NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData

What is wrong with this....I have spent more that 3 weeks....I sign with as online signin. Please help me....I am very confise....My program runs
if I click at application menu....It run well.


Submitted by antoni on Wed, 2008-08-20 10:41.

hi arsubahan ,

try this one

in your UID3.rss file use "RESOURCE STARTUP_ITEM_INFO startexe" instead of "RESOURCE STARTUP_ITEM_INFO Epoc32Sys"



copyright 2003-2009 NewLC SARL