Skip to content

A code scanning plugin for Tasker that uses the Google Code Scanner API.

Notifications You must be signed in to change notification settings

abhishekabhi789/GCS_for_Tasker

Repository files navigation


GCS for Tasker

API 21+ GitHub release (latest by date including pre-releases) GitHub all releases

A code scanning plugin for Tasker that uses the Google Code Scanner API.

⚙️ Requirements

  • This is a Tasker Plugin, and it requires the Tasker Android app to function.

  • This app works on Android 5.0(Lollipop) and higher devices as the Code Scanner API works on devices with this API level or above.

  • The app works only on devices having updated Google Play Services installed.

🛡️ Permissions

  • Manage overlay permission (Draw-over-other-apps permission)

    From Android 10 - Q (API 29) android system restricted launching activities from background(more info here). App will be exempted from this restriction if it has the manage overlay permission.

  • Post Notification

    On some low memory devices, the android system kills the app when it goes to background while scanner UI is visible. Therefore, once scanning is done, the app may not be running to receive the result. Running a service may keep the app in memory, and it requires a notification to be posted. This permission is not requested at run time because not every device needs it. If you encounter this issue, try granting it.

  • Starting from background

    App has to be white listed from any restriction that can prevent starting the scanner from background, like Open new windows while running in the background in MiUi.

🧬 Variants

There are two variants available for this project based on the theme used in plugin configuration activity. The classic variant is smaller in size, and material variant is twice as bigger. Both variants share the same package name and are signed with the same key, so you can switch between them anytime. It is recommended to clear the app data after switching to free up storage space consumed by the previous variant.

🛠️ How to Setup

Install this plugin app and Tasker.

In Tasker

  • For events, select the "Event" option, then choose "Plugin" and select "GCS for Tasker" from the list. From there, you can configure the event based on your preferences.

    • Value filter: The event will trigger only when the raw value of the scanned code matches the value filter. This field supports both simple and regex matching. Use the switch next to this field to choose matching method.
    • Type filter: The event will trigger only when the qr code type matches any of the type filter. Refer Barcode.BarcodeValueType for more about code types.
    • Format filter: The event will trigger only when the code format matches any of the format filter. Refer Barcode.BarcodeFormat for more about code formats.

    The event will trigger only if all specified filters are satisfied.

  • For actions, select "Plugin" from the action list, and then choose "GCS for Tasker". Then on the configuration activity you can configure below settings.

    • Format filter: The code scanner will only detect codes having the chosen format.
    • Enable auto zoom: The scanner will try to automatically zoom the camera towards the code.
    • Allow manual input: The scanner allows manual input of code value.

In GCS for Tasker

After completing the Tasker setup, try to perform a scan.

  • If scanner modules are present, you will see the camera opened with the Google Code Scanner UI.
  • If scanner modules are absent, you will see a toast message saying "Waiting for the Barcode UI module to be downloaded."
    • This download is a background task and is handled by the Google Play Service. You won't be notified when the task is completed.

Here's a demo project. Import it from TaskerNet

The app also initializes a shortcut during the first scan. From this app shortcut, you'll be able to choose a Tasker task related to the scanner for quick access, such as GCS4T: View History in the demo project.

🔧 Troubleshoot

Scanner module not downloading.

  • Ensure internet connection.
  • Make sure the battery saver is turned off.
  • Update play service if available.
  • Reboot the device.

If problem persists try

  • clearing the data of Google Play Services (:warning: Use caution when deleting)
  • Try upgrading or downgrading Google Play Services.

Scanner Action not launching

  • Remove any restriction such as battery saver, background start, draw-over-other-apps, notification and try again.
  • If the issue persists, report it here.

Error: Failed to scan code.

If the scanner returns 'Failed to scan code' error, try clearing the app data of Google Play Service. It's a Google Code Scanner module related issue.