/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page android_support.html
\title Qt for Android
\brief Provides information about Android support in Qt.

Qt for Android enables you to run Qt 5 applications on devices with Android
v2.3.3 (API level 10) or later. All Qt modules (essential and add-on) are
supported except Qt WebKit, Qt NFC, Qt Serial Port, and the
platform-specific ones (Qt Mac Extras, Qt Windows Extras, and Qt X11 Extras).

The following list summarizes what you can do with Qt for Android:

\list
 \li Run \l{Qt Widgets}{Widget} and
     \l{QML Applications}{QML} applications on the device
     or emulator.
 \li Handle \l{Qt Multimedia}{Multimedia} content in your Qt Quick 2
     applications.
 \li Get \l{Qt Sensors}{sensor} readings and react to the changes.
 \li Retrieve current position data using satellite and network
     information.
 \li Establish a serial connection to other \l{Qt Bluetooth}{Bluetooth}
     devices.
 \li Develop secure applications using OpenSSL library.
 \li Create and deploy Application Package (APK) using Qt Creator.
\endlist

The following topics provide more details about how to use Qt for Android:
\list
 \li \l{Getting Started with Qt for Android}{Getting Started}
 \li \l{Porting to Android}{Porting a Qt Application}
 \li \l{Adding OpenSSL Support}
 \li \l{Qt Creator: Deploying Applications to Android Devices}{Deploying to the Device}
 \li \l{Publishing to Google Play}
 \li \l{Platform and Compiler Notes - Android}{Platform Notes}
 \li \l{Building Qt 5 for Android}{Building from Sources}
 \li \l{Android GNU C++ run-time licensing}
\endlist
*/

/*!
\page androidgs.html
\title Getting Started with Qt for Android
\brief Provides instructions to install and configure your development environment.

\section1 Requirements
In order to use \l{Qt for Android}, you need the following:

\list
\li \l{http://developer.android.com/sdk/index.html}{The Android SDK Tools}
\li \l{http://developer.android.com/tools/sdk/ndk/index.html}{The Android NDK}
\li \l{http://ant.apache.org/bindownload.cgi}{Apache Ant} v1.8 or later
\li \l{http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html}{Java SE Development Kit} (JDK) v6 or later. You can also use \l{http://openjdk.java.net}{OpenJDK} on Linux.
\li On Windows, you need the following additional installations:
  \list
    \li MinGW v4.8.0 revision 2
    \li Android Debug Bridge (ADB) driver on the Windows platform to enable USB
        debugging. The default USB driver on Windows does not allow debugging.
        For details about how to get the USB driver, see
        \l{http://developer.android.com/sdk/win-usb.html}.

        After installing the driver, try running a few basic
        \l{http://developer.android.com/tools/help/adb.html}{adb} commands and
        check whether your device responds to it.
  \endlist
\endlist

\note You must set the \c{JAVA_HOME} environment variable to the JDK install
directory path so that Qt Creator finds the binaries required to build your
application.

After installing these tools, update the Android SDK to get the API
and tools packages required for development. You can update the SDK using the
\l{http://developer.android.com/tools/help/android.html}{android} tool that
comes with the SDK Tools package. For example, on Ubuntu the following command
starts the \l{http://developer.android.com/sdk/installing/adding-packages.html}
{Android SDK Manager}, which enables you to select the packages you want
to install:

\code
./android update sdk
\endcode

\section1 Installing Qt for Android

The Qt 5 installers for different platforms are available from the \l Downloads
page. Choose the one that is appropriate.

\note Enterprise packages are available from the \l{Try Qt Enterprise}
page. Qt for Android is also available as part of Qt Mobile Edition,
see \l{Qt Enterprise}{qt.digia.com} for details.

Once you have the installer, follow these steps:

\list 1
 \li Run the installer to begin installing Qt 5 on your development platform.
 \li Select the components you need in the \uicontrol{Select Components}
     screen and click \uicontrol Next.
 \li After the installation is complete, the installer lets you open Qt Creator
     and the README. Select to open Qt Creator and click \uicontrol Finish.
 \li Select \uicontrol{Tools > Options > Android} in Qt Creator to add
     the Android NDK and SDK paths. For more details, see
     \l{Qt Creator: Connecting Android Devices}{Qt Creator Manual}.
\endlist

Now you can test your development setup by running the examples that came
with the Qt 5 package installed earlier. You can browse the examples in
Qt Creator \uicontrol Welcome mode. Use the \c android filter in the search
field to list all the examples tested on Android.

To develop a simple application from scratch, see \l{Creating a Mobile Application}.
*/
/*!
\page portingtoandroid.html
\title Porting to Android
\brief Provides instructions to port your existing Qt application to Android.

In this section, we are going to port an existing Qt Application to
\l{Qt for Android}{Android} and deploy it to the device.

Most Qt applications should be portable to Android with ease, unless they
depend on a specific hardware or software feature not supported by Android.
If your application is not using any such feature, deployment is probably the
only step that demands some changes to your application.

\include porting-notes.qdocinc using resources

The other approach is to deploy the resources into the package's \c{assets}
directory. It is the best option if you want to achieve better
interoperability with the Android APIs. You can access all resources in the
directory using the "assets:" prefix. Unlike qrc, this approach is not a
cross-platform solution.

The following step-by-step instructions guide you to port an existing Qt Quick
application to Android using the qrc approach:

\list 1
 \li Open the existing project in Qt Creator and configure it
     with "Android for ARM" kit. For more information, see
     \l{Qt Creator: Configuring Projects}
 \li Update all local directory imports in the \c{qml} files to use a local
     namespace. For example, to import the QML documents in the "contents"
     directory relative to \c{main.qml}, use the following import statement:

     \code
     import "contents" as Contents
     \endcode
 \li Identify all the resources used by your application and add them to one
     or more qrc files.
     Qt Creator updates your qmake project file with the "RESOURCES"
     variable listing the qrc files you added.
 \li To load or refer to the resources in the qrc file from a C++ file,
     use the "qrc:" prefix with the URL. For example, to load
     the \c{main.qml} file from \c{resources.qrc}, you can use the following
     code in your \c{main} function:
     \code
     QQuickView viewer;
     viewer.setSource(QUrl("qrc:qml/main.qml"));
     viewer.show();
     \endcode

     \note QML documents can refer to the contents in qrc files using the
     relative path to the document. Such references do not require the
     "\c{qrc:}" or "\c{:/}" prefix.
 \li Update the "Run" settings for your project as described in the
     \l{Qt Creator: Specifying Run Settings}

     \note You can change the default settings for application icons and
     identifier.
 \li If your application uses imports or plugins which depend on special Qt
     modules, these Qt modules should be added to the .pro file. For example, if
     your application uses the \l{Qt Multimedia} import in QML, you should add
     the following to your .pro file:
     \code
     QT += multimedia
     \endcode
 \li Save the changes to your project and run the application.
\endlist

Qt Creator deploys your application on the Android device, if the
device is detected by the PC. Otherwise, it tries to run the application on an
AVD (Android Virtual Device). You will be prompted to create one if there are no
AVDs found.
*/

/*!
\page opensslsupport.html
\title Adding OpenSSL Support
\brief Provides instructions to bundle OpenSSL libraries with your Qt application for Android.

The Qt installation package does not ship the OpenSSL libraries due to legal
restrictions in some countries. If you want to use OpenSSL in your application,
you must build the OpenSSL libraries for Android and bundle them with your
Application Package (APK) to ensure that your application behaves as expected
on the device.

\note If your development platform is Windows, you need \c msys with
\c perl v5.14 or later to build OpenSSL.

The following instructions guide you to add OpenSSL support to your application:
\list 1
 \li Download the latest OpenSSL sources from \l{ http://www.openssl.org/source}.
 \li Extract the sources to a folder and navigate to that folder using
     the CLI (\c msys shell on Windows).
 \li Set the following environment variables to point to the ARM compiler
     toolchain and sysroot you want to use:
     \code
     CC=<ANDROID_NDK_PATH>/toolchains/arm-linux-androideabi-<VER>/prebuilt/<NDK_HOST>/bin/arm-linux-androideabi-gcc
     AR=<ANDROID_NDK_PATH>/toolchains/arm-linux-androideabi-<VER>/prebuilt/<NDK_HOST>/bin/arm-linux-androideabi-ar
     ANDROID_DEV=<ANDROID_NDK_PATH>/platforms/android-9/arch-arm/usr
     \endcode
 \li Configure the OpenSSL sources to build for Android (ARMv5 or ARMv7) using
     the following command:

     \code
     ./Configure shared android or android-armv7
     \endcode

     \note You can also configure it for \e mips or \e x86 architectures.
 \li Run \c{make build_libs} to build the \c libcrypto and \c libssl shared
     libraries.
 \li Open your Qt project using Qt Creator and update the
     "Deployment Configuration" under run settings to add \e libcrypto and
     \e libssl as additional libraries required for your project.
 \li Run your application to see it running on the device.
\endlist

Qt Creator builds your application and creates an application package (APK)
with the OpenSSL libraries bundled in it. Once the APK is ready, Qt Creator
prompts you to choose the device to install the APK, and then you should
see your application running on the device you selected.

*/

/*!
\page publishtogoogleplay.html
\title Publishing to Google Play
\brief Provides instructions to prepare your application for publishing.

\l{Qt for Android} provides a complete solution to develop, build, and package
your applications for Android. Most of these tasks, especially packaging and
deployment are handled by Qt Creator providing rich developer experience.

Every time you run the application using Qt Creator, an Android Application
Package (APK) is created and deployed onto the target (device or emulator) you
choose. With some minor changes to how the \e .apk is created, you can publish
your application on Google Play and monetize from it. The following
step-by-step instructions guide you to create an \e{.apk} that can go live
on Google Play:
\list 1
 \li Open your application project using Qt Creator v3.0 or later and change
 its \uicontrol Build settings to build release version.

 \li Open \uicontrol Run settings of your project and select
 \uicontrol {Create AndroidManifest.xml}. Qt Creator adds the manifest XML
 based on the application's \e .pro file and opens it in \uicontrol General
 mode.

 \note You can edit the \e AndroidManifest.xml in \uicontrol General or
 \uicontrol {XML Source} mode.

 \li Check for the following in \e AndroidManifest.xml:
 \list
  \li \uicontrol{Minimum required SDK} is set to API 9 or above.

  \note Qt for Android is supported on devices with API 9 and above.

  \li Add \uicontrol{Application name} and \uicontrol{Application icon}.

  \li \uicontrol Permissions list has all the required permissions.

  \li \uicontrol Features list has the software or hardware features that your
      application depends on. For example, NFC.
 \endlist

 \note Qt adds the default permissions and features based on the module
 dependencies of your application. If you do not want these default permissions
 and features, remove the \c{<!-- %%INSERT_PERMISSIONS -->} and
 \c{<!-- %%INSERT_FEATURES -->} comments from \e AndroidManifest.xml. For
 information on the manifest XML format, see \l{Android: App Manifest}.

 \li Set up a \uicontrol keystore to sign the \e .apk. You can create a new
 keystore if you do not have one.

 \li Select \uicontrol{Open package location after build} and run your
 application to build the \e .apk. Qt Creator builds the \e .apk and opens the
 folder containing the \e .apk.

 \li Log in to the \l{Google Play Developer Console} and upload the \e .apk
 file, few screen captures of the application, and a description.
\endlist

Now your application is available to other Android device users via
Google Play. You can also choose to publish the application to a smaller
group, so that you can test and improve the application before publishing it to
a larger audience.

See \l{Deploying an Application on Android} for more information about how the
packaging is done and how you can influence it.
*/
