Prepare the Manifest

The manifest file of your Android project need to be set with settings that refer to resources provided by the Content Glass library. The following section provide list of settings need to be included:

General uses permissions and settings

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.sosa" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="19"/> <!-- General IO and network access -> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!-- Permissions required by SOSA with location glass patten. --> <!-- Resolution of 1 block = 0.05 mile = 0.08 km --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:required="false" /> <!-- Required by apps that will be use Image capturing to identify an object --> <uses-feature android:name="android.hardware.camera" android:required="false"/> .....

 

Setting use in DirectCGApplication 

The folloiwing is very important. Content Glass application should use special sub-class of Application class - DidectCGApplication. The Class contains the core logic for wrapping an internel ContentGlass engine and mediate between the application and the internal content glass engine. 

<application android:name="cg.android.application.DirectCGApplication" android:icon="@drawable/ic_launcher"> ....

 

 Settings some required meta data

Note that as for the application Id provided here it is for trial version only and you sould not use it in your applications. Instead, you must get your own application Id be registering your application in the applications management portal.

 

<application android:name="cg.android.application.DirectCGApplication" android:icon="@drawable/ic_launcher"> <!-- Content Glass meta data. You must get your own application id from applications portal and set instead of default Id which is used for trial versions only --> <meta-data android:name="rhz.cg.app_id" android:value="540959d3e2083"/> <!-- Google Play service meta data. Required when using Location Glass pattern --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="[Yuor API Key as provided by Google Developers consule]"/> .....

 

Declaring useful activities

You may not need all the activities with the package: "cg.android.view.state" anyway we present thsoe activities here. Also note that since API is evolving we may not present here all the state identification wizard activities. Anyway, there might be activities not presented here that you wil have to add to your minifest for certain conditions.

<!-- ================================================================== --> <!-- Activities required by Contentglass views --> <!-- ================================================================== --> <activity android:name="cg.android.view.settings.CGPreferences" android:label="Content Glass Preferences"/> <activity android:name="cg.android.view.WebViewActivity" android:label=""/> <activity android:name="cg.android.view.pge.PeersGroupEditorActivity" android:label="Peers Groups Editor"/> <activity android:name="cg.android.view.selector.WidgetSelectorActivity" android:label="Widget Selector"/> <activity android:name="cg.android.view.state.SelectStateWizard" android:label="Sharing Wizard"/> <activity android:name="cg.android.view.state.TextStateIdWizard" android:label="Share By Text"/> <!--<activity android:name="cg.android.view.state.PictureStateIdWizard" android:label="Share By Picture"/>--> <!--<activity android:name="cg.android.view.state.LocationStateIdWizard" android:label="Share By Location" />--> <!-- <activity android:name="cg.android.view.state.QRCodeStateId" android:label="Share By Code"/>-->