Skip to content

Vision Configuring the ANE

Eoin Landy edited this page Jan 30, 2020 · 10 revisions

Android

The ANE + Dependencies

Firstly, complete the Configuring the ANE section for Analytics.

Secondly, complete the Configuring the ANE section for Remote Config.

The following are the lists of Extensions for the full set of Vision components. Delete entries not required.

<extensions>
	...
    <extensionID>com.google.firebase.firebase-ml-vision</extensionID>
    <extensionID>com.google.firebase.firebase-ml-natural-language</extensionID>
    <extensionID>com.google.firebase.firebase-ml-vision-image-label-model</extensionID>
    <extensionID>com.google.firebase.firebase-ml-vision-barcode-model</extensionID>
    <extensionID>com.google.firebase.firebase-ml-vision-face-model</extensionID>
    <extensionID>com.google.firebase.firebase-ml-model-interpreter</extensionID>
    <extensionID>com.tuarua.firebase.VisionANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionBarcodeANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionFaceANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionTextANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudTextANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudDocumentANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionLabelANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudLabelANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionLandmarkANE</extensionID>
    <extensionID>com.tuarua.firebase.NaturalLanguageANE</extensionID>
    <extensionID>com.tuarua.firebase.ModelInterpreterANE</extensionID>
    ...
</extensions>

You will also need to include the following in your app manifest.

<manifest android:installLocation="auto">
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CAMERA" />
    ...
    <!-- If using Barcode and Camera input -->
    <uses-feature android:name="android.hardware.camera" android:required="false"  />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    <application android:enabled="true">
        ...
	    <service android:name="com.google.firebase.components.ComponentDiscoveryService" >
	        <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.vision.VisionRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.common.CommonComponentRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.naturallanguage.NaturalLanguageRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.naturallanguage.translate.NaturalLanguageTranslateRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.custom.CustomModelRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
	        ...
	    </service>
    
        <!-- If using Barcode and Camera input -->
        <activity android:name="com.tuarua.firebase.ml.vision.PermissionActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

        <activity android:excludeFromRecents="false" android:hardwareAccelerated="true">
           <intent-filter>
               <action android:name="android.intent.action.MAIN"/>
               <category android:name="android.intent.category.LAUNCHER"/>
           </intent-filter>
        </activity>
        ...
    </application>
    
</manifest>

iOS

The ANE + Dependencies

N.B. You must use a Mac to build an iOS app using this ANE. Windows is NOT supported.

Firstly, complete the Configuring the ANE section for Analytics.

Secondly, complete the Configuring the ANE section for Remote Config.

The following are the lists of Extensions for the full set of Vision components. Delete entries not required.

<extensions>
    <extensionID>com.tuarua.firebase.VisionANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionBarcodeANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionFaceANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionTextANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudTextANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudDocumentANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionLabelANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionCloudLabelANE</extensionID>
    <extensionID>com.tuarua.firebase.VisionLandmarkANE</extensionID>
    <extensionID>com.tuarua.firebase.NaturalLanguageANE</extensionID>
    <extensionID>com.tuarua.firebase.ModelInterpreterANE</extensionID>
    ...
</extensions>

You will also need to include the following in your app manifest.

<InfoAdditions>
    <![CDATA[
        <key>NSCameraUsageDescription</key>
        <string>You need to allow camera to use VisionANE Sample</string>
        ...
    ]]>
</InfoAdditions>

You will also need to package GoogleMVFaceDetectorResources.bundle and GoogleMVTextDetectorResources.bundle in the root when packaging your AIR app if using Face and Text respectively.

Clone this wiki locally