Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Device Development

Similar presentations


Presentation on theme: "Mobile Device Development"— Presentation transcript:

1 Mobile Device Development
The Role of the Android Manifest File 1

2 Agenda Common Features App Permissions User Permissions
Device Permissions 2

3 Common Features App name and package details
Target and minimum SDK versions Permitted Activities Device features and services used by the app Permission to use devices and services Some manifest items are API specific 3

4 Manifest (Hello World)
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.barrydean.helloworld"> <application android:allowBackup="true" android:supportsRtl="true" <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 4

5 Additional Features Permissions to:
Access to app features e.g. Address Book Access hardware e.g. camera Write to external storage Use media components – Audio and Video 5

6 <uses feature> Declares a single hardware or software feature that is used by the application. You must specify each feature in a separate <uses-feature> element. If your application requires multiple features, it would declare multiple <uses-feature> elements. An application that requires both Bluetooth and camera features in the device would declare these two elements: <uses-feature android:name="android.hardware.bluetooth" /> <uses-feature android:name="android.hardware.camera" /> 6

7 <uses permission>
Requests a permission that the application must be granted in order for it to operate correctly. Permissions are granted by the user when the application is installed (on devices running Android 5.1 and lower) or while the app is running (on devices running Android 6.0 and higher). 7

8 SDK Versions // Gradle handles this information in Android Studio
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.barrydean.cameraone" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="19" /> // Gradle handles this information in Android Studio

9 Device Permissions <uses-feature android:name="android.hardware.Camera" /> <uses-feature android:name="android.hardware.Camera.autofocus" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <application android:allowBackup="true"

10 Activity <activity android:name="com.example.barrydean.cameraone.MainActivity" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

11 Summary Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest file provides essential information about the app to the Android system, which the system must have before it can run any of the app's code. It names the Java package for the application. The package name serves as a unique identifier for the application. The Target SDK version and Minimum SDK version for the app. It describes the components of the application e.g. the activities. It declares device features the application will access e.g. the camera It declares permissions the app will require to access such as hardware and write file access to external storage. 11


Download ppt "Mobile Device Development"

Similar presentations


Ads by Google