You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Make sure to check out [this demo app](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/tree/master/demo-ng) because it has almost all ML Kit features this plugin currently supports! Steps:
@@ -22,11 +16,26 @@ In case you're upgrading and you have the `firebase.nativescript.json` file in y
22
16
then clean your platforms folder (`rm -rf platforms`) and build your app again. You will be prompted which Firebase features you'll want to use.
23
17
24
18
## ML Kit Features
25
-
There are two ways of using ML Kit: On-device or in the cloud. Depending on the
19
+
There are two ways of using ML Kit:
26
20
27
21
-*On-device*. These features have been enhanced to not only interpret still images, but you can also run ML against a live camera feed. Why? Because it's fr***ing cool!
28
22
-*Cloud*. The cloud has much larger and always up to date models, so results will be more accurate. Since this is a remote service reconition speed depends heavily on the size of the images you send to the cloud.
29
23
24
+
### On-device configuration
25
+
Optionally (but recommended) for Android, you can have the device automatically download the relevant ML model(s) to the device
26
+
after your app is installed from the Play Store. Add this to your `<resources>/Android/AndroidManifest.xml`:
Now you're able to use the registered element in the view:
111
+
112
+
```html
113
+
<MLKitTextRecognition
114
+
class="my-class"
115
+
width="260"
116
+
height="380"
117
+
processEveryNthFrame="10"
118
+
(scanResult)="onTextRecognitionResult($event)">
119
+
</MLKitTextRecognition>
120
+
```
121
+
122
+
You can use any view-related property you like as we're extending `ContentView`.
123
+
So things like `class`, `row`, `width`, `horizontalAlignment`, `style` are all valid properties.
124
+
125
+
Plugin-specific are the optional property `processEveryNthFrame` and optional event `scanResult`.
126
+
You can `processEveryNthFrame` set to a lower value than the default (5) to put less strain on the device.
127
+
Especially 'Face detection' seems a bit more CPU intensive, but for 'Text recognition' the default is fine.
128
+
129
+
> Look at [the demo app](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/tree/master/demo-ng) to see how to wire up that `onTextRecognitionResult` function.
130
+
131
+
### XML
132
+
Declarate a namespace at the top of the embedding page, and use it somewhere on the page:
<imgsrc="https://raw.githubusercontent.com/EddyVerbruggen/nativescript-plugin-firebase/master/docs/images/features/mlkit_face_detection.png"height="153px"alt="ML Kit - Face detection"/>
formats: [BarcodeFormat.QR_CODE, BarcodeFormat.CODABAR] // limit recognition to certain formats (faster), or leave out entirely for all formats (default)
197
+
}).then((result:MLKitScanBarcodesOnDeviceResult) => { // just look at this type to see what else is returned
0 commit comments