Android

Default manifest

NeoMAD uses a default manifest file when compiling a project for an Android target. This file only contains the basic information needed to have an Android application compiling and running on devices.

As a consequence, developers who do not have to change anything in the manifest content have nothing specific to do.

Using a specific manifest

Developers who want to add specific content to the manifest can use a template to create their own manifest files.

This template is located at:

  • NeoMAD_Installation_directory/fromSdk/android/androidManifest.xml

The content of this template is the same as the default one used by NeoMAD.

If the default Android manifest provided by NeoMAD is not sufficient for your application or if you need to activate options for a specific target, you can create your own manifest. Copy/paste the template wherever you want in the project and add your specific content. Then, tell NeoMAD to use your manifest file by using the <androidmanifest> tag in the URS file.

WARNING You may notice some words beginning with “$”, like “$VERSION”. These tags are used by NeoMAD to automatically substitute data picked from the URS file. This is why your manifest file must be based on the template provided by NeoMAD. All the options declared in the template manifest file using these tags MUST be kept and MUST NOT be overridden.

Sample

Here is a sample of Android manifest called AndroidManifest-settime.xml. In this example, we consider that we added some specific android code in the NeoMAD project in order to set the device system time from our application. We need to add the corresponding permission “SET_TIME” in the manifest.

<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: Do not remove or modify the NeoMAD Tags !! -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      android:versionCode="$VERSION_CODE"
      android:versionName="$VERSION" package="$PACKAGE" >
   <application android:icon="@drawable/icon"
         android:label="$APPLICATION_NAME"
         android:debuggable="true"
         android:description="@string/description"
         android:allowClearUserData="true">
      <activity android:name="$PACKAGE.$ACTIVITY"
            android:label="$APPLICATION_NAME"
            android:launchMode="singleTask"
            android:configChanges="keyboardHidden|orientation">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
   $PERMISSIONS
   <!-- If you want to specify the <screen-support> tag by yourself,
       remove the following variable. -->
   $SUPPORTS_SCREENS
   <!-- Add your code here -->
   <uses-permission android:name="android.permission.SET_TIME ">
       </uses-permission>
</manifest>

Let’ s go back to our “Hello World” example and say we have copied the AndroidManifest-settime.xml at the root of our project.

In the URS file, we can add the following line:

<androidmanifest path="AndroidManifest-settime.xml" />

This line means that when compiling for Android, NeoMAD will use the “AndroidManifest-settime.xml” manifest file located at the root of the project.

When compiling for older targets, the NeoMAD default manifest will be used.