Skip to content

Vision Configuring the ANE

Tua Rua edited this page Nov 7, 2018 · 10 revisions

Android

The ANE + Dependencies

Firstly, complete the Configuring the ANE section for Analytics.

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

<extensions>
    <extensionID>org.jetbrains.kotlinx.kotlinx-coroutines-android</extensionID>
    <extensionID>com.google.android.gms.play-services-vision-image-label</extensionID>
    <extensionID>com.google.firebase.firebase-ml-vision</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>
    
    ...
</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">
        <meta-data
            android:name="com.google.firebase.ml.vision.DEPENDENCIES"
            android:value="face,barcode,text,label" />
            <!-- To use multiple models: android:value="face,model2,model3" -->

        <!-- If using Barcode and Camera input -->
        <activity android:name="com.tuarua.firebase.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.

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>
    ...
</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