Class AndroidBarcodeScanService

java.lang.Object
com.gluonhq.attach.barcodescan.impl.AndroidBarcodeScanService
All Implemented Interfaces:
BarcodeScanService

public class AndroidBarcodeScanService extends 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" />
    
 
  • Constructor Details

    • AndroidBarcodeScanService

      public AndroidBarcodeScanService()
  • Method Details

    • scan

      public Optional<String> scan()
      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:
      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 Optional<String> scan(String title, String legend, 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:
      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.
    • setResult

      public static void setResult(String v)