0

I have a Vision API Barcode scanner logic which is based on play-services-vision:17.0.2 to scan barcodes and QR codes. This is working on most phones apart for the users in the China region where play services and stores are disabled.

So, I need to find a way if Vision API is allowed or not and make a switch to either use full-fledged Vision API or fallback to the minimal feature of ZXing library.

For this, I tried googleApiAvailability.isGooglePlayServicesAvailable(activity) and included com.google.android.gms:play-services-base:17.1.0.

However, after installing the app I am receiving a message that "to open the app Play services and Play store apps are required". How can I address this?

Is there any other way to find out and make the proper switch of features or maybe better ways to handle this?

Thank you...

aminography
  • 21,986
  • 13
  • 70
  • 74
harshal
  • 592
  • 6
  • 25

1 Answers1

0

I found this code snippet in another question and it helped me.

      try {
            packageManager.getPackageInfo("com.google.android.gms", 0);
            // - >Installed
        } catch (PackageManager.NameNotFoundException e) {
           // -> Not installed
        }
harshal
  • 592
  • 6
  • 25