detector.isOperational() always false on android

后端 未结 7 601
遇见更好的自我
遇见更好的自我 2021-01-18 08:26

I\'m using the new google plays service: Barcode detector, for this porposue I\'m following this tutorial : https://search-codelabs.appspot.com/cod

相关标签:
7条回答
  • 2021-01-18 09:05

    you must not forget this:

    add this to your AndroidManifest.xml

    <application
       android:allowBackup="true"
       android:icon="@mipmap/ic_launcher"
       android:label="@string/app_name"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:supportsRtl="true"
       android:theme="@style/AppTheme">
    
    
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data
        android:name="com.google.android.gms.vision.DEPENDENCIES"
        android:value="ocr"/>
    
    0 讨论(0)
  • 2021-01-18 09:06

    It looks like the first time barcode detector is used on each device, some download is done by Google Play Services. Here is the link:

    https://developers.google.com/vision/multi-tracker-tutorial

    And this is the excerpt:

    The first time that an app using barcode and/or face APIs is installed on a device, GMS will download a libraries to the device in order to do barcode and face detection. Usually this is done by the installer before the app is run for the first time.

    0 讨论(0)
  • 2021-01-18 09:07

    Here is what was my case. I was using BarcodeDetector for decoding QR codes from imported images. On 4 my testing devices it was working fine. On one was not reading anything from bitmap. I thought this might be incompatibility with android 5.0 but this was not the case. After hours of investigation I finally noticed that detector.isOperational(); returns false. The reason was:

    The first time that an app using barcode and/or face APIs is installed on a device, GMS will download a libraries to the device in order to do barcode and face detection. Usually this is done by the installer before the app is run for the first time.

    I had wi-fi off on that testing device. After turning it on and relaunching app, detector became operational and started decoding bitmaps.

    0 讨论(0)
  • 2021-01-18 09:08

    Sometimes detector dependencies are downloaded when the app runs for the first time and not when the app installs. I too faced the same issue, the problem is either your network connection is weak or you don't have enough storage for download say 10% of the total space though it does not take that much space but downloads from Google Play Services does require good amount of storage and don't forget to clear cache(Simple check try to update any application from playstore). Refer this Github thread for more information.

    0 讨论(0)
  • 2021-01-18 09:10

    To use the API, it's necessary to have internet connection, I had connection to my ADSL but not resolved DNS. Fixing that problem make my app works

    0 讨论(0)
  • 2021-01-18 09:20

    Check your storage! make sure it is over 10%

    That fixed my problem, and I answered it here too...

    https://stackoverflow.com/a/43229272/6914806

    0 讨论(0)
提交回复
热议问题