Class AndroidBarcodeScanService

  • All Implemented Interfaces:
    BarcodeScanService

    public class AndroidBarcodeScanService
    extends java.lang.Object
    implements BarcodeScanService
    Requires this permission: android.permission.CAMERA And this activity added to the AndroidManifest.xml:
     
      <activity android:name="com.gluonhq.helloandroid.zxing.CaptureActivity"
            android:screenOrientation="sensorLandscape"
            android:clearTaskOnLaunch="true"
           android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden">
             <intent-filter>
                 <action android:name="com.gluonhq.attach.barcodescan.android.SCAN"/>
                <category android:name="android.intent.category.DEFAULT"/>
              </intent-filter>
        </activity>
        <activity android:name="com.gluonhq.helloandroid.PermissionRequestActivity" />
        
     
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void asyncScan()
      Starts up the scanner functionality (commonly provided via the camera), and then parsed by Attach to determine the string the barcode represents.
      void asyncScan​(java.lang.String title, java.lang.String legend, java.lang.String resultText)
      Starts up the scanner functionality (commonly provided via the camera), and then parsed by Attach to determine the string the barcode represents.
      javafx.beans.property.ReadOnlyStringProperty resultProperty()
      A read-only property containing the result of the scan.
      java.util.Optional<java.lang.String> scan()
      Starts up the scanner functionality (commonly provided via the camera), in a blocking way, and then parsed by Attach to determine the string the barcode represents.
      java.util.Optional<java.lang.String> scan​(java.lang.String title, java.lang.String legend, java.lang.String resultText)
      Starts up the scanner functionality (commonly provided via the camera), in a blocking way, and then parsed by Attach to determine the string the barcode represents.
      static void setResult​(java.lang.String v)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AndroidBarcodeScanService

        public AndroidBarcodeScanService()
    • Method Detail

      • scan

        public java.util.Optional<java.lang.String> scan()
        Description copied from interface: BarcodeScanService
        Starts up the scanner functionality (commonly provided via the camera), in a blocking way, and then parsed by Attach to determine the string the barcode represents.
        Specified by:
        scan in interface BarcodeScanService
        Returns:
        Returns an Optional containing the parsed string. The Optional may be empty if the String fails to be parsed for any reason, or if the user cancels the operation.
      • scan

        public java.util.Optional<java.lang.String> scan​(java.lang.String title,
                                                         java.lang.String legend,
                                                         java.lang.String resultText)
        Description copied from interface: BarcodeScanService
        Starts up the scanner functionality (commonly provided via the camera), in a blocking way, and then parsed by Attach to determine the string the barcode represents.
        Specified by:
        scan in interface BarcodeScanService
        Parameters:
        title - The title of the scan view. If null or empty nothing will be displayed.
        legend - An explanatory message displayed in the scan view. If null or empty nothing will be displayed.
        resultText - The text to display when the scan ends successfully, before the scanned text. If empty or null, the result won't be shown.
        Returns:
        Returns an Optional containing the parsed string. The Optional may be empty if the String fails to be parsed for any reason, or if the user cancels the operation.
      • asyncScan

        public void asyncScan()
        Description copied from interface: BarcodeScanService
        Starts up the scanner functionality (commonly provided via the camera), and then parsed by Attach to determine the string the barcode represents.
        Specified by:
        asyncScan in interface BarcodeScanService
      • asyncScan

        public void asyncScan​(java.lang.String title,
                              java.lang.String legend,
                              java.lang.String resultText)
        Description copied from interface: BarcodeScanService
        Starts up the scanner functionality (commonly provided via the camera), and then parsed by Attach to determine the string the barcode represents.
        Specified by:
        asyncScan in interface BarcodeScanService
        Parameters:
        title - The title of the scan view. If null or empty nothing will be displayed.
        legend - An explanatory message displayed in the scan view. If null or empty nothing will be displayed.
        resultText - The text to display when the scan ends successfully, before the scanned text. If empty or null, the result won't be shown.
      • resultProperty

        public javafx.beans.property.ReadOnlyStringProperty resultProperty()
        Description copied from interface: BarcodeScanService
        A read-only property containing the result of the scan.
        Specified by:
        resultProperty in interface BarcodeScanService
        Returns:
        a read-only object property containing a string with the barcode or QR code scan
      • setResult

        public static void setResult​(java.lang.String v)