The Android Manifest File
When you build an Android app by using Volt MX Iris, an AndroidManifest.xml
file is created in the app's corresponding dist
folder. The file is located at WorkspaceName>/temp/
The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app’s package name that helps the Android SDK while building the app. The Android manifest file provides information such as activities, services, broadcast receivers, and content providers of an android application.
With Volt MX Iris, you can define the following options in the AndroidManifest.xml
file:
- Supported screen sizes
- Supported SDK versions: minimum, target, and maximum
- Ability to send Push Notifications
- Various permissions for the application
To modify the Android Manifest.xml
file from Iris, follow these steps:
- From the Project Explorer, click Project Settings. The Project Settings window appears.
- Click the Native tab.
- Click the Android sub-tab, and then scroll down to the Manifest Properties & Gradle Entries section.
- Configure the Permissions, Tags, and Deeplink URL scheme tabs. More information on how to
to configure manifest properties such as Permissions, Tags,and Deeplink URL in the Android Manifest file. Here is an example of a basic Android Manifest file generated with default permissions.
Permissions
An app must have certain permissions to access data from the other apps. By default, Volt MX Iris enables and disables certain permissions in the AndroidManifest.xml
file. When you build an application, an AndroidManifest.xml
file is automatically generated for the app. This manifest file will contain permissions based on how you have configured those permissions. If you have not specified any permissions explicitly, default permissions would apply.
For more information on the AndroidManifest.xml
file, refer App Manifest on the Android Developer site.
The following permissions are set to true and added by default:
- ACCESS_NETWORK_STATE
- INTERNET
- READ_PHONE_STATE
These permissions are set to false by default. You can add the permissions according to the requirements.
ACCESS_COARSE_LOCATION | ACCESS_FINE_LOCATION | ACCESS_LOCATION_EXTRA_COMMANDS |
ACCESS_MOCK_LOCATION | ACCESS_SURFACE_FLINGER | ACCESS_WIFI_STATE |
ACCOUNT_MANAGER | AUTHENTICATE_ACCOUNTS | BATTERY_STATS |
BIND_APPWIDGET | BIND_DEVICE_ADMIN | BIND_INPUT_METHOD |
BIND_REMOTEVIEWS | BIND_WALLPAPER | BLUETOOTH |
BLUETOOTH_ADMIN | BRICK | BROADCAST_PACKAGE_REMOVED |
BROADCAST_STICKY | BROADCAST_WAP_PUSH | CALL_PHONE |
CALL_PRIVILEGED | CAMERA | CHANGE_COMPONENT_ENABLED_STATE |
CHANGE_CONFIGURATION | CHANGE_NETWORK_STATE | CHANGE_WIFI_MULTICAST_STATE |
CHANGE_WIFI_STATE | CLEAR_APP_CACHE | CLEAR_APP_USER_DATA |
CONTROL_LOCATION_UPDATES | DELETE_CACHE_FILES | DELETE_PACKAGES |
DEVICE_POWER | DIAGNOSTIC | DISABLE_KEYGUARD |
DUMP | EXPAND_STATUS_BAR | FACTORY_TEST |
FLASHLIGHT | FORCE_BACK | GET_ACCOUNTS |
GET_PACKAGE_SIZE | GET_TASKS | GLOBAL_SEARCH |
HARDWARE_TEST | INJECT_EVENTS | INSTALL_LOCATION_PROVIDER |
INSTALL_PACKAGES | INTERNAL_SYSTEM_WINDOW | KILL_BACKGROUND_PROCESSES |
MANAGE_ACCOUNTS | MANAGE_APP_TOKENS | MASTER_CLEAR |
MODIFY_AUDIO_SETTINGS | MODIFY_PHONE_STATE | MOUNT_FORMAT_FILESYSTEMS |
MOUNT_UNMOUNT_FILESYSTEMS | NFC | PERSISTENT_ACTIVITY |
PROCESS_OUTGOING_CALLS | READ_CALENDAR | READ_CONTACTS |
READ_FRAME_BUFFER | READ_HISTORY_BOOKMARKS | READ_INPUT_STATE |
READ_LOGS | READ_SMS | READ_SYNC_SETTINGS |
READ_SYNC_STATS | REBOOT | RECEIVE_BOOT_COMPLETED |
RECEIVE_MMS | RECEIVE_SMS | RECEIVE_WAP_PUSH |
RECORD_AUDIO | REORDER_TASKS | RESTART_PACKAGES |
SEND_SMS | SET_ACTIVITY_WATCHER | SET_ALARM |
SET_ALWAYS_FINISH | SET_ANIMATION_SCALE | SET_DEBUG_APP |
SET_ORIENTATION | SET_PREFERRED_APPLICATIONS | SET_PROCESS_LIMIT |
SET_TIME | SET_TIME_ZONE | SET_WALLPAPER |
SET_WALLPAPER_HINTS | SIGNAL_PERSISTENT_PROCESSES | STATUS_BAR |
SUBSCRIBED_FEEDS_READ | SUBSCRIBED_FEEDS_WRITE | SYSTEM_ALERT_WINDOW |
UPDATE_DEVICE_STATS | USE_CREDENTIALS | USE_SIP |
VIBRATE | WAKE_LOCK | WRITE_APN_SETTINGS |
WRITE_CALENDAR | WRITE_CONTACTS | WRITE_EXTERNAL_STORAGE |
WRITE_GSERVICES | WRITE_HISTORY_BOOKMARKS | WRITE_SECURE_SETTINGS |
WRITE_SETTINGS | WRITE_SMS | WRITE_SYNC_SETTINGS |
Set Android Manifest Permissions
You can modify the permissions in the AndroidManifest.xml
file based on the requirements of the application.
To set the permissions in the Android Manifest file, follow these steps:
- In Volt MX Iris, from the Project Explorer, click Project Settings. The Project Settings window appears.
- Click the Native tab.
- Click the Android sub-tab and then scroll down to the Manifest Properties & Gradle Entries section.
-
To enable permissions, select the permissions from the left pane and click Add >.
For example, If you need to save images to an external storage device such as USB drive or SD card, add the WRITE_EXTERNAL_STORAGE setting.Note: To select multiple permissions, hold the Ctrl key and click the permissions. To select continuously listed permissions, hold the Shift key and click the permissions.
-
To disable permissions, select the permissions from the right pane and click < Remove.
-
Click Finish.
When you build the app, Volt MX Iris generates the manifest file with the permissions that you specified.- If the app lists normal permissions in its manifest (permissions that don't pose risk to the user's privacy or the device's operation), the system automatically grants those permissions to the app.
- If the app lists dangerous permissions in its manifest (permissions that could potentially affect the user's privacy or the device's normal operation), the app must explicitly request those permissions.
For more information on requesting runtime permissions, refer Runtime Permissions.
For more information on the list of dangerous permissions, refer Dangerous Permissions List.
Tags
Apart from the permissions, you can also configure tags such as application and activity. Following is a list of the manifest tags that can be configured from Iris:
- Child Tag entries under
tag -
Child Tag entries under
tag -
Application Tag Attributes (ex: android:name=”string”)
-
Manifest Tag Attributes
-
Child Tag Entries under Main Launcher
tag -
Main Launcher
Tag Attributes
For example, manifest attributes can be modified in the Android manifest file as follows.
<manifest xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: tools = "http://schemas.android.com/tools"
package = "com.orgname.Sample"
android: versionCode = "1"
android: versionName = "1.0.0" //Manifest attributes>
For more information on Android Manifest tags and their attributes, refer Manifest Elements
Deeplink URL Scheme
You can use the URL Scheme tab for Deeplinking. The values for Scheme/ port/ path/host/pathprefix/path pattern specified under the Deeplink URL tab can be used to deep-link to a particular URL directly.
For example, if a scheme is defined as https and a host is defined as www.example.com, the following entry will be added to the Android manifest.xml
file under intent-filter tag of default activity.
<intent-filter> <data android: scheme = "https"
android: host = "www.example.com"/> </intent-filter>
Android Manifest Example
The following is a basic AndroidManifest.xml
file that is generated with default permissions.
<? xml version = "1.0"
encoding = "utf-8" ?>
//Manifest attributes
< manifest
xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: tools = "http://schemas.android.com/tools"
package = "com.orgname.Sample"
android: versionCode = "1"
android: versionName = "1.0.0" >
//Application attributes are added here
< application
android: name = "com.konylabs.android.KonyApplication"
android: icon = "@drawable/Sample_icon"
android: label = "@string/app_name"
tools: remove = "supportsRtl"
tools: replace = "icon" >
//Activity attributes are added here
< activity
android: name = ".Sample"
android: configChanges = "locale|keyboardHidden|orientation|screenSize|screenLayout"
android: label = "@string/app_name"
android: launchMode = "singleTask"
android: screenOrientation = "sensor"
android: theme = "@style/Theme.AppCompat.NoActionBar"
android: windowSoftInputMode = "adjustResize" > < intent - filter > < action android: name = "android.intent.action.MAIN" / > < category android: name = "android.intent.category.LAUNCHER" / > < /intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" / > < category android: name = "android.intent.category.DEFAULT" / > < /intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable
" /> //Deeplink text is added here
//Add Child Tag Entries under Main Launcher here if required
</activity>
<meta-data
android:name="
android.app.default_searchable "
android:value=".VoltMXMain " />
<provider
android:name="
com.orgname.Sample.SampleSearchSuggestionProvider "
android:authorities="
com.orgname.Sample.SampleSuggestionProvider " />
</application>
//supported screens
<supports-screens
android:anyDensity="
true "
android:largeScreens="
true "
android:normalScreens="
true "
android:smallScreens="
true "
android:xlargeScreens="
true " />
//These are the default permissions set as true
// Add permissions here
<uses-permission android:name="
android.permission.READ_PHONE_STATE " />
<uses-permission android:name="
android.permission.ACCESS_NETWORK_STATE " />
<uses-permission android:name="
android.permission.INTERNET " />
//Add the Manifest child tags here if required
</manifest>