textRecognizer.isOperational()在模拟器上返回true,在实际设备上返回false

时间:2018-11-16 10:01:25

标签: android

我正在为Android使用Text Recognization API,但遇到了问题。 textRecognizer在模拟器上运行良好,但是当我在实际设备中对其进行检查时,它在以下位置显示错误:

   textRecognizer.isOperational()

在实际设备中返回false,而在模拟器上返回true。关于这个问题有什么解决方案吗?

textRecognizer =新的TextRecognizer.Builder(this).build();

    //checking if textRecognizer is operational
    if (!textRecognizer.isOperational()) {
        Toast.makeText(this, "Dependency not available", Toast.LENGTH_SHORT).show();


        IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
        boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;

        if (hasLowStorage) {
            Toast.makeText(this, "VERY LOW STORAGE", Toast.LENGTH_LONG).show();
        }



        return;
    } 

清单也包括以下内容:

  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.INTERNET" />

0 个答案:

没有答案
相关问题