In this article I will show you how to prepare your MeeGo* app to be validated in the Intel AppUpSM Center. This article is based on the project from my another article Modern mobile applications with Qt* and QML. No changes will be made in the project source code. Thanks to Qt*, our Windows* application can be launched on MeeGo* without any changes in code. All you need is just to recompile it.
Integrating AppUp™ SDK
Launch Qt Creator* installed with MeeGo* SDK. If you don't have MeeGo* SDK installed, here is a link. On this page you can find everything you need to start developing MeeGo* apps.
Open project, open project file (4Toddler.pro) and add following lines:
# Add path to Intel AppUp™ SDK headers directory
INCLUDEPATH += "$$(IADP_SDK_DIR_MEEGO)Cpp/include"
# Add required libraries
LIBS += -lxml2 -lpthread
LIBS += "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libadpruntime.a" \
"$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libadpcore.a" \
"$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libxerces-c.a" \
"$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libxml-security-c.a" \
"$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libcrypto.a"
Next open main.cpp file. Include header file from the Intel AppUp™ SDK:
#include "adpcppf.h"
And new function:
bool IsAuthorized()
{
#ifdef QT_DEBUG
// Do not check authorization for debug version
return true;
#endif
bool authorized = false;
QString message;
com::intel::adp::Application *pApp = NULL;
try
{
pApp = new Application(ADP_DEBUG_APPLICATIONID);
// Authorized successfully
authorized = true;
}
catch (com::intel::adp::AdpException& e)
{
// Got some error
message = QString::fromAscii(e.message());
}
if(pApp != NULL)
{
delete pApp;
}
if(authorized == false)
{
QMessageBox msgBox(QMessageBox::Information, "4 Toddler", message, QMessageBox::Ok);
msgBox.exec();
}
return authorized;
}
Call this function from your main()
if(IsAuthorized() == false)
{
// Quit application
a.quit();
return 0;
}
Creating RPM package
To install and run the application on MeeGo* we need to create an RPM package. RPM is something like an archive with binaries, icons, libraries, application info inside it. You can find a lot of info about RPM at www.rpm.org.
The Intel AppUpSM Developer Program has some requirements for RPMs described here MeeGo* Packaging and Compliance Guidelines.
First we need to create additional icons in PNG file format in sizes: 16x16, 32x32, 64x64, and 128x128.
Next we need to create a .desktop file for our application. This file contains some info for the OS about our application category, icon, binary file path. Create a new file with name 4Toddler.desktop.
[Desktop Entry]
Name=4 Toddler
GenericName=4 Toddler
Comment=4 Toddler application
Exec=/opt/com.company.4toddler/4Toddler
Categories=Games
Icon=4toddler
Type=Application
Terminal=false
StartupNotify=true
Name - specific name of the application
GenericName - generic name of the application
Comment - tooltip for the entry
Exec - path to program to execute, possibly with arguments
Categories - categories in which the entry should be shown in a menu. Information about all categories can be found here
Icon - icon file name
Type - type of desktop entry. Can be Application, Link or Directory
Terminal - whether the program runs in a terminal window
Full description for all keys inside the desktop file can be found at here.
Next we need to make some changes in our project file. We should tell Qt Creator* which file should be packed to our RPM.
# Files to be packed and installed
target.path = /opt/com.company.4toddler/
icon.files = Icon/4toddler.png
icon.path = /usr/share/icons/
icon16.files = Icon/16/4toddler.png
icon16.path = /usr/share/icons/hicolor/16x16/apps/
icon32.files = Icon/32/4toddler.png
icon32.path = /usr/share/icons/hicolor/32x32/apps/
icon64.files = Icon/64/4toddler.png
icon64.path = /usr/share/icons/hicolor/64x64/apps/
icon128.files = Icon/128/4toddler.png
icon128.path = /usr/share/icons/hicolor/128x128/apps/
desktop.files = 4Toddler.desktop
desktop.path = /usr/share/applications
sounds.files = Sounds/*.wav
sounds.path = /var/opt/com.company.4toddler/sounds/
ui.files = UI/*.*
ui.path = /var/opt/com.company.4toddler/UI/
stars.files = UI/Stars/*.png
stars.path = /var/opt/com.company.4toddler/UI/Stars/
icons.files = UI/Icons/*.png
icons.path = /var/opt/com.company.4toddler/UI/Icons/
INSTALLS += target icon icon16 icon32 icon64 icon128 desktop sounds ui stars icons
Why do I choose /opt/com.company.4toddler/ for binaries and /var/opt/com.company.4toddler/sounds/ for application files? This is a requirement, described in MeeGo* Packaging and Compliance Guidelines.
Last thing, we should add spec file to our project. This file is needed to build RPM file from our project files. Add new 4Toddler.spec file:
# Define package name
%define app_name com.company.4toddler
Name: 4toddler
Version: 1.0.1
Release: 1
License: Intel
Summary: 4 Toddler Application
Url: http://you_company_website.com
Group: Amusements/Games
Requires: libqt >= 4.7.0
%description
Application description
%prep
%setup -q
%build
# Add commands here to compile the package.
make
%install
make install INSTALL_ROOT=%{buildroot}
%files
%defattr(-,root,root,-)
/opt/%{app_name}
%{_datadir}/applications/*.desktop
%{_datadir}/icons/*.png
%{_datadir}/icons/hicolor/16x16/apps/*.png
%{_datadir}/icons/hicolor/32x32/apps/*.png
%{_datadir}/icons/hicolor/64x64/apps/*.png
%{_datadir}/icons/hicolor/128x128/apps/*.png
/var/opt/%{app_name}/sounds/*.wav
/var/opt/%{app_name}/UI/*.*
/var/opt/%{app_name}/UI/Stars/*.*
/var/opt/%{app_name}/UI/Icons/*.*
Name - package name. Name of your application
Version - software version
Release - package version
Url - Url to your application web site
Group - package group
Requires - package requirements
You can read more about spec files here.
As you can see, the sec file contains several sections, marked with %. The most interesting section is the %files section. In this section you should define paths to all your installed files. If you forget to include something, this file will not be packed and installed.
Hint: To make sure all files are inside RPM package and have valid paths, I use 7-Zip. Using 7-Zip you can open and explore RPM packages.
Done! Your application is ready to be built, deployed on a device and submitted to the Intel AppUpSM Center. But don't forget to rename your package before submission to:
com.companyname.appname.rpm
Some useful links:
MeeGo* Packaging and Compliance Guidelines
Integrating the Intel AppUp™ SDK Suite in a MeeGo* app
Building a MeeGo* Application for AppUpSM using Windows* Development Environment
Installing the MeeGo* SDK for Windows*
Packaging/Guidelines - MeeGo* Wiki
Packaging/Tutorial - MeeGo* Wiki
Desktop file specifications
http://www.rpm.org/max-rpm/index.html
Have a question? Do not hesitate to ask.
Good luck!
