question

ComptonAlvaro avatar image
0 Votes"
ComptonAlvaro asked ·

Is it possible to use ML Kit on device in a xamarin.android application?

I am trying to develop my first application using xamarin.android and i would like to use ML Kit Vision to scan QR codes. I am searching information and all I can find is examples using ML Kit firbase, that if I am not wrong, I need to create an account in and also it uses the cloud, so I need internet connection. I would like to can use my application without internet connection.

However, I see that now google offers the ML Kit on device, that allows to use the ML Kit without needed an internet connection, so it seems what I am looking for. The google documention is this.

Also, in the xamarin android, I could find a question about if it was missed the binding to ML Kit, and the post was close 8 days ago because the binding is added. So if I am not wrong, that means that now I could use ML Kit on device in the xamarin android. Is this true? The question in xamarin web is this. Here they mention that until know, there was available the com.google.firebase but that the new libraries to can use ML Kit on device are com.google.mlkit and it seems that the new binding that was added 8 days ago it is for com.google.mlkit.

But my main doubt is how to import or reference the ML Kit library to can use the new libraries. Because if I search in nuget.org for com.google.mlkit I don't get results, but if I search for com.google.firebase I find many packages. Could someone give some guidelines to can start?



Thanks so much.

dotnet-xamarinessentials
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JessieZhang-2116 avatar image
0 Votes"
JessieZhang-2116 answered ·

Hello,


Welcome to our Microsoft Q&A platform!

But my main doubt is how to import or reference the ML Kit library to can use the new libraries. Because if I search in nuget.org for com.google.mlkit I don't get results, but if I search for com.google.firebase I find many packages. Could someone give some guidelines to can start?

If I understand correctly, do you want nuget Xamarin.Google.MLKit.BarcodeScanning, right?

And the google document is this: https://developers.google.com/ml-kit/vision/barcode-scanning/android


Best Regards,

Jessie Zhang


If the response is helpful, please click "Accept Answer" and upvote it.


Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes, but I want to use in Xamarin.Android project, and I can't use the same code than in the documentation of google.

In google I have this code:

 var options = BarcodeScannerOptions.Builder
                 .setBarcodeFormats(Barcode.FormatQrCode)
                 .build();


But Builder has not the method setBarcodeFormats neither build, so I don't know how to do.

0 Votes 0 ·
SujeendranMenon-8086 avatar image
0 Votes"
SujeendranMenon-8086 answered ·

I was also looking for the same for pose detection model and can't find any documentation for it although the nuget packages are available here:
https://www.nuget.org/packages/Xamarin.Google.MLKit.Common/
https://github.com/xamarin/GooglePlayServicesComponents

You can see that all the nuget packages were added in the last month, but none of them have any documentation:
https://www.nuget.org/packages?q=xamarin.google.mlkit

Do share if you find any!

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ElteHupkes-9780 avatar image
0 Votes"
ElteHupkes-9780 answered ·

I think the Xamarin.Google.MLKit.* packages that started appearing on NuGet a month ago are what OP is looking for. For what it's worth, the (deprecated) Xamarin.Firebase.ML.Vision will let you run some functionalities offline just as the new package does - it just requires an annoying Firebase dependency. In both cases the models need to be downloaded before first use by the way; there are entries you can add to your manifest to do this on install.

As a side note, I'm not currently aware of any Xamarin.iOS bindings for MLKit - again similar Firebase packages exist and are functional, just require an annoying Firebase setup. I hope these will be released sooner rather than later.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.