Starting Qt executable on device boot in Qt

From Qt Wiki
Jump to navigation Jump to search

Template:ArticleMetaData

Overview[edit | edit source]

This code snippet demonstrates how to configure Qt console executable binary so that it is started automatically on Symbian device boot.

Capabilities[edit | edit source]

Startup List Management API does not work with Self-Signed application. It should be signed with Open Signed Online even if otherwise the capabilities required for the application do not need it.

Qt console app[edit | edit source]

  1. into .pro file

TEMPLATE = app

  1. Executable name

TARGET = myconsoleexename

  1. Remove qui from the application

QT += core QT -= gui

  1. That hides Symbian application icon from device application menu

CONFIG += no_icon

Example of console main.cpp

  1. include <QtCore>
  2. include <QCoreApplication>
  3. include "MyConsoleMainClass.h"

int main(int argc, char *argv[]) {

   // NOTE: There is no QApplication, it's QCoreApplication
   QCoreApplication a(argc, argv);
   // Some class that is created/executed when application starts
   MyConsoleMainClass myClass;
   return a.exec();

}

Start on device boot[edit | edit source]

We use Nokia Startup List API

The first step is to create a specific resource file that will contain the boot information. Name have to be your application UID3.rss (e.g. E2E04FD2.rss)

  1. include <startupitem.rh>

RESOURCE STARTUP_ITEM_INFO startexe {

   executable_name = "\\sys\\bin\\myconsoleexename.exe";
   recovery = EStartupItemExPolicyNone;

}

The resource file described above shall now be added to the compilation process. Add these lines into Qt project file and then qmake generates suitable Symbian MMP file

  1. into .pro file

symbian {

   # For app to boot on device startup
   # that comes into .MMP file
   forStartupOnBoot = \
   "SOURCEPATH      ." \
   "START RESOURCE E2E04FD2.rss" \
   "END"
   MMP_RULES += forStartupOnBoot   

}

Compiled resource file E2E04FD2.rsc have to deploy into Symbian SIS package. So these lines add needed line into Symbian PKG file. Note that source name is E2E04FD2.rsc, but target have to be [E2E04FD2].rsc

  1. into .pro file

symbian {

   # For app to boot on device startup
   # that comes into .PKG file
   rscDeployment = "\"$${EPOCROOT}epoc32/data/E2E04FD2.rsc\" - \
   \"!:/private/101f875a/import/[E2E04FD2].rsc\""
   deployFiles.pkg_postrules += rscDeployment
   DEPLOYMENT += deployFiles

}

Postconditions[edit | edit source]

Qt Console application is started on device boot and it does not contain application icon.

See also[edit | edit source]