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

ComptonAlvaro 166 Reputation points
2021-02-27T09:05:23.233+00:00

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.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,272 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. JessieZhang-MSFT 7,701 Reputation points Microsoft Vendor
    2021-03-01T10:01:58.72+00:00

    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.


  2. Sujeendran Menon 1 Reputation point
    2021-03-11T13:45:58.723+00:00

    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!

    0 comments No comments

  3. Elte Hupkes 1 Reputation point
    2021-03-30T10:36:01.807+00:00

    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.

    0 comments No comments