-The `android` module provides support for the Android platform
+Android platform support and APIs
# Compilation for Android
# Host system configuration
-To compile for Android, you must install the Android SDK and NDK.
-The tools `android`, `ndk-build` and `ant` must be in your PATH.
+Some configuration is required to compile for the Android platform from a GNU/Linux host.
-# Configure your Android application
+1. Download and install the latest Android SDK __and__ NDK.
+
+2. Update PATH so it includes the tools `android`, `ndk-build` and `ant`.
+ You should add something like the following snippet to your .bashrc or equivalent,
+ be careful to replace `ANDROID_SDK` and `ANDROID_NDK` with the full path where you installed each package.
+
+ ~~~
+ export PATH=$PATH:ANDROID_SDK/tools/:ANDROID_SDK/platform-tools/:ANDROID_NDK/
+ ~~~
+
+2. Using the `android` executable, download the latest `tools, build-tools` and within the Android 4.0.3 (API 15) folder, install `SDK platform`.
+ You may have to install additional SDK platforms for applications with different targets.
-The `app.nit` framework and this project offers some services to
-customized the generated Android application.
+3. Using your OS package manager, install `apt openjdk-7-jdk lib32stdc++6 lib32z1`.
+ On Debian and Ubuntu the command is:
-## Module annotations
+ ~~~
+ sudo apt-get install apt openjdk-7-jdk lib32stdc++6 lib32z1
+ ~~~
-* `app_version` specifies the version of the generated APK file.
-It takes 3 arguments: the major, minor and revision version numbers.
-The special function `git_revision` will use the prefix of the hash of the
-latest git commit. The default version is 1.0.
+# Configure your Android application
- Example: `app_version(1, 0, git_revision)`
+The _app.nit_ framework and this project offers some services to
+customize the generated Android application.
-* `app_name` takes a single argument, the visible name of the Android
-application. By default, the compiler would use the name of the target
-module. This name will be used as the name of the main activity and
-as the launcher name.
+## Annotations
- Example: `app_name "My App"`
+* All _app.nit_ annotations are applied to Android projects:
+ `app_name`, `app_namespace` and `app_version`.
-* `java_package` specifies the package used by the generated Java
-classes and the APK file. Once the application is published, this
-value should not be changed. By default, the compiler will use
-the package `org.nitlanguage.{module_name}`.
+ See: `../app/README.md`
* Custom information can be added to the Android manifest file
using the annotations `android_manifest`, `android_manifest_application`
android_manifest """<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>"""
~~~
-* The API version target can be specified with `min_api_version`,
-`max_api_version` and `target_api_version`. These take a single
+* The API version target can be specified with `android_api_min`,
+`android_api_max` and `android_api_target`. These take a single
integer as argument. They are applied in the Android manifest as
`minSdkVesion`, `targetSdkVersion` and `maxSdkVersion`.
See http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
* The annotation `android_activity` defines a Java class used as an
- entrypoint to your application. As of now, this annotation should
- only be used by low level implementations of Nit on Android.
- It's usefulness will be extended in the future to customize user applications.
+ entry point to your application. As of now, this annotation should
+ only be used by low-level implementations of Nit on Android.
+ Its usefulness will be extended in the future to customize user applications.
+
+## Android implementation
+
+There is two core implementation for Nit apps on Android.
+`android::nit_activity` is used by apps with standard windows and native UI controls.
+`android::game` is used by, well, games and the game frameworks `mnit` and `gamnit`.
+
+Clients don't have to select the core implementation, it is imported by other relevant modules.
+For example, a module importing `app::ui` and `android` will trigger the importation of `android::nit_activity`.
-## Project entry points
+## Lock app orientation
Importing `android::landscape` or `android::portrait` locks the generated
application in the specified orientation. This can be useful for games and
optionally `TSA_SERVER`. These settings can be set in a startup script such as
`~/.bashrc` or in a local Makefile.
- You can use the following commands by replacing the right hand values
+ You can use the following commands by replacing the right-hand values
to your own configuration.
~~~