-
Notifications
You must be signed in to change notification settings - Fork 16
M.1 Add Mlkit
- Make sure you are considering the minimum requirements for running Firebase.
- Install the Firebase SDK.
- In the Firebase console, add your app to your Firebase project.
Before adding MLKit (or any of the other Firebase child ANEs) to your AdobeAIR app, you need to make sure you have setup the firebaseCore.ane correctly in your project. IMPORTANT: To add MLKit, you need to add the required ANEs and Frameworks to your project. These dependencies are explained in details in this document.
MLKIT is still in beta version. For some unknown reason, Mlkit.createVisionImageFromFile
is not working!, instead you may use other methods.
Air manifest .xml file
Beside changes you need to make to your manifest .xml file when implementing the firebaseCore.ane
you need to add the following changes also to make the MLKit ANE work properly:
<!--
Optional but recommended: If you use the on-device API, configure your app to automatically
download the ML model to the device after your app is installed from the Play Store.
-->
<meta-data
android:name="com.google.firebase.ml.vision.DEPENDENCIES"
android:value="ocr,face,barcode,label"/>
<!-- To use only one model: android:value="ocr" -->
<!--
Change "YOUR.PACKAGE.NAME" to your own applicationID but keep
".provider" at the end. [your-app-id].provider
-->
<provider
android:name="com.myflashlabs.firebase.mlkit.AneMLKITProvider"
android:authorities="YOUR.PACKAGE.NAME.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/mlkit_ane_provider_paths"/>
</provider>
<extensions>
<!--
Required ANEs for the Firebase Core ANE comes here first.
https://github.com/myflashlab/Firebase-ANE/wiki/A.4.-Initialize-Firebase-in-your-app
-->
<!-- Firebase MLKIT -->
<extensionID>com.myflashlab.air.extensions.firebase.mlkit</extensionID>
<!-- Dependency ANEs for Firebase MLKIT -->
<extensionID>com.myflashlab.air.extensions.dependency.firebase.ml</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.auth</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.vision</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.clearcut</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.flags</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.phenotype</extensionID>
<extensionID>com.myflashlab.air.extensions.dependency.tensorflow</extensionID>
</extensions>
In the Firebase iOS SDK you downloaded from this page, copy the following resources to your projects assets folder. These files must be accessible from File.applicationDirectory
. Make sure these files are included in your app package.
- MLVisionFaceModel/Resources/GoogleMVFaceDetectorResources.bundle
- MLVisionTextModel/Resources/GoogleMVTextDetectorResources.bundle
- MLNLSmartReply/Resources/PredictOnDeviceResource.bundle
Download MLKit Android resources from here and copy all the files there to your projects assets folder. These files must be accessible from File.applicationDirectory
. Make sure these files are included in your app package.
Notice: There's a folder named models, you must also include that folder and everything in it. But make sure you are actually adding the folder to your project resources and do not take out the files in it to ther locations. Firebase SDK will look for those files relatively.
Enjoy building Air apps – With ♥ from MyFlashLabs Team
Introduction to Firebase ANEs collection for Adobe Air apps
Get Started with Firebase Core in AIR
- Prerequisites
- Add Firebase to your app
- Add the Firebase SDK
- Init Firebase Core
- Available ANEs
- Managing Firebase iid
Get Started with Authentication
- Add Authentication
- Init Authentication
- Manage Users
- Phone Number
- Custom Auth
- Anonymous Auth
- State in Email Actions
- Email Link Authentication
Get Started with FCM + OneSignal
- Add FCM ANE
- Init FCM ANE
- Send Your 1st Message
- Send Msg to Topics
- Understanding FCM Messages
- init OneSignal
- Add Firestore
- Init Firestore
- Add Data
- Transactions & Batches
- Delete Data
- Manage the Console
- Get Data
- Get Realtime Updates
- Simple and Compound
- Order and Limit Data
- Paginate Data
- Manage Indexes
- Secure Data
- Offline Data
- Where to Go From Here
Get Started with Realtime Database
- Add Realtime Database
- Init Realtime Database
- Structure Your Database
- Save Data
- Retrieve Data
- Enable Offline Capabilities
Get Started with Remote Config
- Add Storage ANE
- Init Storage ANE
- Upload Files to Storage
- Download Files to Air
- Use File Metadata
- Delete Files