Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested documentation improvement #162

Closed
5 of 11 tasks
viking2917 opened this issue Jun 28, 2024 · 3 comments · Fixed by #163
Closed
5 of 11 tasks

Suggested documentation improvement #162

viking2917 opened this issue Jun 28, 2024 · 3 comments · Fixed by #163
Labels
docs Improvements or additions to documentation package: barcode-scanning platform: android Android platform

Comments

@viking2917
Copy link

Plugin(s)

  • Barcode Scanning
  • Face Detection
  • Face Mesh Detection
  • Selfie Segmentation
  • Translation

Version

6.1.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

I encountered the issue where older Android devices will fail on a call to the scan() menu, because the Google Barcode Scanner is not pre-installed. Even though I am somewhat experienced with this plugin, I spent the better part of two days investigating and implementing my own solution to this, before I noticed the documentation notes under scan() regarding installGoogleBarcodeScannerModule() and isGoogleBarcodeScannerModuleAvailable(). This is after multiple reads of the installation instructions for Android. I did not think to look under scan() per se.

I suggest adding documentation to the Android installation section covering this issue. I will create a PR with a suggested documentation update.

Expected behavior

Android installation documentation should cover the optional use of installGoogleBarcodeScannerModule().

Reproduction

https://github.com/viking2917/capacitor-mlkit

Steps to reproduce

Review the current Android installation documentation.

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.1.0
@capacitor/core: 6.1.0
@capacitor/android: 6.1.0
@capacitor/ios: 6.1.0

Installed Dependencies:

@capacitor/cli: 6.1.0
@capacitor/core: 6.1.0
@capacitor/android: 6.1.0
@capacitor/ios: 6.1.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.
@viking2917 viking2917 added bug/fix Something isn't working needs: triage labels Jun 28, 2024
@viking2917
Copy link
Author

My suggested edit is as follows, at the end of the Android installation instructions

Older Android Devices/Versions

Some Android devices, especially older ones, may not have the Google Barcode Scanner available, and the scan() method will fail. This can be addressed using the isGoogleBarcodeScannerModuleAvailable() and installGoogleBarcodeScannerModule() methods. Also see the notes below regarding isGoogleBarcodeScannerModuleAvailable().

BarcodeScanner.isGoogleBarcodeScannerModuleAvailable().then((res: IsGoogleBarcodeScannerModuleAvailableResult) => {
  if (!res.available) {
    BarcodeScanner.addListener('googleBarcodeScannerModuleInstallProgress',
      (event: GoogleBarcodeScannerModuleInstallProgressEvent) => {
        if (event.state === GoogleBarcodeScannerModuleInstallState.COMPLETED) {
          // module is installed and ready to go.
        }
      });
    BarcodeScanner.installGoogleBarcodeScannerModule();
 }
});

If that is felt desirable, please assign the issue to me and I will submit a PR.

@robingenz
Copy link
Member

The Installation section should only contain documentation that is required to install the plugin itself. However, these are implementation details. Therefore, I will adapt the error message instead, so that the developer is explicitly referred to the method (see #163).

@robingenz robingenz added platform: android Android platform package: barcode-scanning docs Improvements or additions to documentation and removed needs: triage bug/fix Something isn't working labels Jun 28, 2024
@viking2917
Copy link
Author

awesome that sounds great. thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs Improvements or additions to documentation package: barcode-scanning platform: android Android platform
Projects
None yet
2 participants