The AndroidManifest.xml
file (the Android Manifest) is the place where an app announces information that the system, Google Play, and other apps might need to know. For example, Goldgesture requires a front-facing camera and permission to use it (a license to shoot, one might say). Goldgesture also expects to run in landscape mode regardless of the physical orientation of the phone, because OpenCV's camera preview always uses the camera's landscape dimensions. (OpenCV's Android documentation does not indicate whether this behavior is intended. Perhaps future versions will provide better support for portrait orientation.) To specify these requirements, edit AndroidManifest.xml
to match the following sample:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nummist.goldgesture" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera.front" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <activity android:name="com.nummist.goldgesture.CameraActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name= "android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Now, our app can use a camera and will remain in landscape mode. Also, if we publish it on Google Play, it will only be available to devices with a front-facing camera.