×
Namespaces

Variants
Actions

Starting Qt executable on device boot in Qt

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N97
Compatibility
Platform(s): S60 5th Edition
Symbian
Article
Keywords: QCoreApplication
Created: tepaa (26 May 2010)
Last edited: hamishwillee (11 Oct 2012)

Contents

Overview

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

Capabilities

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

# into .pro file
 
TEMPLATE = app
# Executable name
TARGET = myconsoleexename
 
# Remove qui from the application
QT += core
QT -= gui
 
# That hides Symbian application icon from device application menu
CONFIG += no_icon

Example of console main.cpp

#include <QtCore>
#include <QCoreApplication>
#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

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)

#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

# 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

# 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

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

See also

This page was last modified on 11 October 2012, at 04:18.
44 page views in the last 30 days.