Skip to content

Commit ed0f6d6

Browse files
v0.7.5
- Scanner closes on action timeout. - Targeting sdk 35 - Overall code optimized - Some deprecated codes removed - Improved UI - Enabled MaterialYou theming for material variant. - Overlay permission will be asked during action setup
1 parent 5315a32 commit ed0f6d6

47 files changed

Lines changed: 1190 additions & 1058 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 53 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,46 @@
55
</picture><br>
66
<h1 align="center">GCS for Tasker</h1>
77
<a href="https://developer.android.com/tools/releases/platforms#5.0">
8-
<img alt="API 21+" src="https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=for-the-badge&color=FF0800" title="Android 5.0 Lollipop"></a>
9-
<a href="https://github.com/abhishekabhi789/GCS_for_Tasker/releases">
10-
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/abhishekabhi789/GCS_for_Tasker/total?style=for-the-badge&color=00C853" title="Total download count"></a>
8+
<img alt="API 21+" src="https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=for-the-badge&color=FF0000" title="Android 5.0 Lollipop"></a>
119
<a href="https://github.com/abhishekabhi789/GCS_for_Tasker/releases/latest">
1210
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/abhishekabhi789/GCS_for_Tasker?include_prereleases&style=for-the-badge&color=0091EA" title="latest release version"></a>
13-
<a href="https://taskernet.com/shares/?user=AS35m8mVC%2FNlWH31JCTnGHpKVeZk1osEp8V1pFxCq1Ls28Un1RXCw9ZNWWvmpxOebt4WIYFeiZhZKHc%3D&id=Project%3AGCS4T+Example+Project">
14-
<img alt="demo project download" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Ftaskernet.com%2F_ah%2Fapi%2Fdatashare%2Fv1%2Fshares%2FAS35m8mVC%252FNlWH31JCTnGHpKVeZk1osEp8V1pFxCq1Ls28Un1RXCw9ZNWWvmpxOebt4WIYFeiZhZKHc%253D%2FProject%253AGCS4T%2520Example%2520Project%3Fa%3D0&query=%24.info.stats.downloads&prefix=Downloads%3A%20&style=for-the-badge&label=Taskernet&labelColor=yellow&color=grey" title="import the demo project from taskernet" ></a>
15-
16-
</div>GCS for Tasker is an Android application that can act as both a Tasker event plugin and action
17-
plugin. This app uses the Google Code Scanner API to scan and extract information from QR codes.<br>
11+
<a href="https://github.com/abhishekabhi789/GCS_for_Tasker/releases">
12+
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/abhishekabhi789/GCS_for_Tasker/total?style=for-the-badge&color=00C853" title="Total download count"></a>
13+
<br>
14+
<br>
15+
A code scanning plugin for <a href="https://joaoapps.com/tasker/">Tasker</a> that uses the <a href="https://developers.google.com/ml-kit/vision/barcode-scanning/code-scanner">Google Code Scanner</a> API.
16+
</div>
1817

1918
## :gear: Requirements
2019

21-
This is a [Tasker Plugin](https://tasker.joaoapps.com/plugins-intro.html), and it requires
22-
the [Tasker](https://joaoapps.com/tasker/) Android app to function. To use this app, you must have
23-
an Android device with an API level
24-
of [21](https://developer.android.com/tools/releases/platforms#5.0 "Android 5.0 Lollipop") or
25-
higher, as the Code Scanner API works on devices with
26-
this API level or above. Furthermore, it is necessary to have the Google Play Services installed on
27-
the device.
20+
- This is a [Tasker Plugin](https://tasker.joaoapps.com/plugins-intro.html), and it requires the [Tasker](https://joaoapps.com/tasker/) Android app to function.
21+
22+
- 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.
2823

29-
## :bulb: Features
24+
- The app works only on devices having updated Google Play Services installed.
3025

31-
With the GCS for Tasker app, you can easily integrate QR code scanning into your Tasker projects.
32-
This app supports both scanning events and actions. This app doesn't ask for camera permissions, nor
33-
does it store or share any data except with Tasker.
26+
## :shield: Permissions
27+
28+
- #### Manage overlay permission (Draw-over-other-apps permission)
29+
From Android 10 - Q (API 29) android system restricted launching activities from background([more info here](https://developer.android.com/guide/components/activities/background-starts)).
30+
App will be exempted from this restriction if it has the manage overlay permission.
31+
32+
- #### Post Notification
33+
On some low memory devices, the android system kills the app when it goes to background while scanner UI is visible.
34+
Therefore, once scanning is done, the app may not be running to receive the result.
35+
Running a service may keep the app in memory, and it requires a notification to be posted.
36+
This permission is not requested at run time because not every device needs it. If you encounter this issue, try granting it.
37+
38+
- ### Starting from background
39+
App has to be white listed from any restriction that can prevent starting the scanner from background, like `Open new windows while
40+
running in the background` in MiUi.
3441

3542
## :dna: Variants
3643

37-
There are two variants available for this project based on the theme used in event configuration
38-
activity. Classic themed app is smaller in size and material themed app is around 4 times bigger.
39-
Both are having same package name and are signed with same key, you can switch them anytime. It's
40-
recommended to clear the app data after such switching to release storage space consumed by previous
41-
variant.
44+
There are two variants available for this project based on the theme used in plugin configuration activity.
45+
The classic variant is smaller in size, and material variant is twice as bigger.
46+
Both variants share the same package name and are signed with the same key, so you can switch between them anytime.
47+
It is recommended to clear the app data after switching to free up storage space consumed by the previous variant.
4248

4349
<details><summary>
4450

@@ -52,26 +58,26 @@ Install this plugin app and Tasker.
5258
- For events, select the "Event" option, then choose "Plugin" and select "GCS for Tasker" from the
5359
list. From there, you can configure the event based on your preferences.
5460

55-
* Value filter: The event will trigger only when the raw value of the scanned code matches the
56-
value filter. This field supports both simple and regex matching. Adjust the switch next to
57-
this field to choose simple matching or regex matching.
58-
* Type filter: The event will trigger only when the qr code type matches any of the type filter.
61+
* **Value filter**: The event will trigger only when the raw value of the scanned code matches the
62+
value filter. This field supports both simple and regex matching. Use the switch next to
63+
this field to choose matching method.
64+
* **Type filter**: The event will trigger only when the qr code type matches any of the type filter.
5965
Refer [Barcode.BarcodeValueType](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode.BarcodeValueType)
6066
for more about code types.
61-
* Format filter: The event will trigger only when the code format matches any of the format
67+
* **Format filter**: The event will trigger only when the code format matches any of the format
6268
filter.
6369
Refer [Barcode.BarcodeFormat](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode.BarcodeFormat)
6470
for more about code formats.
6571

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

68-
- For actions, select "Plugin" from the "Select action category" list, and then choose "GCS for
74+
- For actions, select "Plugin" from the action list, and then choose "GCS for
6975
Tasker". Then on the configuration activity you can configure below settings.
70-
* Format filter: The code scanner will only detect codes having the chosen format.
71-
* Enable auto zoom: The scanner will try to automatically zoom the camera towards the code.
72-
* Allow manual input: The scanner allows manual input of code value.
76+
77+
* **Format filter**: The code scanner will only detect codes having the chosen format.
78+
* **Enable auto zoom**: The scanner will try to automatically zoom the camera towards the code.
79+
* **Allow manual input**: The scanner allows manual input of code value.
7380

74-
All the code types and code formats can be copied from event and action configuration.
7581

7682
#### In GCS for Tasker
7783

@@ -83,34 +89,11 @@ After completing the Tasker setup, try to perform a scan.
8389
* This download is a background task and is handled by the Google Play Service. You won't be
8490
notified when the task is completed.
8591

86-
Here's an example project. Import it
87-
from [TaskerNet](https://taskernet.com/shares/?user=AS35m8mVC%2FNlWH31JCTnGHpKVeZk1osEp8V1pFxCq1Ls28Un1RXCw9ZNWWvmpxOebt4WIYFeiZhZKHc%3D&id=Project%3AGCS4T+Example+Project)
88-
</details>
89-
<details><summary>
90-
91-
## :question: FAQ
92-
93-
</summary>
94-
95-
#### Can this be used on a device that does not have Google Play Services?
96-
97-
> No, the app uses the unbundled Google code scanner API provided by Google Play Services on the
98-
> device.
99-
100-
#### Does the app require an internet connection to function?
101-
102-
> This app does not require an internet connection since the scanner library is capable of working
103-
> offline. However, Google Play Services requires an internet connection to download QR scanner
104-
> libraries if they are not already present on your device.
105-
106-
#### Does clearing app data delete any setup or data?
107-
108-
> For API 25+(Android 7.1+) devices, the shortcut configuration will be cleared when cleaning app
109-
> data. No scanner related functionalities affected with clearing app data. All configuration data is
110-
> stored in Tasker and the scanner library is in google play services. Also, if you want to save the
111-
> scan results, you have to set up a Tasker task to do so.
92+
Here's a demo project. Import it from [TaskerNet](https://taskernet.com/shares/?user=AS35m8mVC%2FNlWH31JCTnGHpKVeZk1osEp8V1pFxCq1Ls28Un1RXCw9ZNWWvmpxOebt4WIYFeiZhZKHc%3D&id=Project%3AGCS4T+Example+Project)
11293

94+
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.
11395
</details>
96+
11497
<details><summary>
11598

11699
## :wrench: Troubleshoot
@@ -120,30 +103,21 @@ from [TaskerNet](https://taskernet.com/shares/?user=AS35m8mVC%2FNlWH31JCTnGHpKVe
120103
#### Scanner module not downloading.
121104

122105
>- Ensure internet connection.
123-
>- Ensure battery saver is turned off.
106+
>- Make sure the battery saver is turned off.
124107
>- Update play service if available.
125-
>- Reboot device.
108+
>- Reboot the device.
126109
>
127110
> If problem persists try
128-
>- clearing the data of Google Play Services (Attention!: Use caution when deleting)
129-
>- Upgrade or downgrade Google Play Services.
111+
>- clearing the data of Google Play Services (:warning: Use caution when deleting)
112+
>- Try upgrading or downgrading Google Play Services.
130113
131-
#### Code Scanned but no response from Tasker.
114+
#### Scanner Action not launching
132115

133-
>- Try a different code to make sure the tasker setup is correct.
134-
>- Check Tasker run log.
135-
>- Try both event and action.
136-
>- Create a new event/action without any filter rules and flash the output.
137-
138-
#### Scanner UI doesn't dismiss after action timeout.
139-
140-
> The library does not provide a method to programmatically close or set a timeout for the scanner.
141-
> You can consider using Tasker/AutoInput to click the close button or the back button after the
142-
> action fails due to timeout.
116+
>- Remove any restriction such as battery saver, background start, draw-over-other-apps, notification and try again.
117+
>- If the issue persists, report it here.
143118
144119
#### Error: Failed to scan code.
145120

146-
> If the scanner throws 'Failed to scan code' error, try clearing the app data
147-
> of [Google Play Service](https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en&gl=US).
148-
> It's a Google Code Scanner module related issue
149-
</details>
121+
> If the scanner returns 'Failed to scan code' error, try clearing the app data of Google Play Service.
122+
> It's a Google Code Scanner module related issue.
123+
</details>

app/build.gradle

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ plugins {
55

66
android {
77
namespace 'com.abhi.gcsfortasker'
8-
compileSdk 34
8+
compileSdk 35
99

1010
defaultConfig {
1111
applicationId "com.abhi.gcsfortasker"
1212
minSdk 21
13-
targetSdk 33
14-
versionCode 74
15-
versionName "0.7.4"
13+
targetSdk 35
14+
versionCode 75
15+
versionName "0.7.5"
1616
}
1717

1818
buildTypes {
19-
debug {
20-
minifyEnabled true
21-
shrinkResources true
22-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23-
}
19+
debug {
20+
minifyEnabled false
21+
shrinkResources false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
2424
release {
2525
minifyEnabled true
2626
shrinkResources true
@@ -51,11 +51,9 @@ android {
5151
}
5252
sourceSets {
5353
classic {
54-
java.srcDirs 'src/classic/java'
5554
res.srcDirs 'src/classic/res'
5655
}
5756
material {
58-
java.srcDirs 'src/material/java'
5957
res.srcDirs 'src/material/res'
6058
}
6159
}
@@ -70,20 +68,19 @@ android {
7068
}
7169

7270
dependencies {
73-
//code scanner - unbundled
71+
implementation 'androidx.appcompat:appcompat:1.7.0'
72+
//code scanner
7473
implementation 'com.google.android.gms:play-services-code-scanner:16.1.0'
7574
//tasker plugin
7675
implementation 'com.joaomgcd:taskerpluginlibrary:0.4.10'
7776
//coroutine
78-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
79-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
77+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
8078
//splashscreen
8179
implementation "androidx.core:core-splashscreen:1.0.1"
8280
//for testing
8381
testImplementation 'junit:junit:4.13.2'
8482
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
8583
//material theming
86-
materialImplementation 'com.google.android.material:material:1.11.0'
87-
materialImplementation 'androidx.constraintlayout:constraintlayout:2.1.4'
88-
89-
}
84+
materialImplementation 'com.google.android.material:material:1.12.0'
85+
materialImplementation 'androidx.constraintlayout:constraintlayout:2.2.0'
86+
}

app/proguard-rules.pro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@
2323
-dontobfuscate
2424
#-keep class com.abhi.gcsfortasker.** { *; }
2525
#-keep class com.joaomgcd.taskerpluginlibrary.** { *; }
26-
#Barcode is accessed via reflection. see utils.kt
26+
# Barcode is accessed via reflection on BarcodeFieldUtils
2727
-keep class com.google.mlkit.vision.barcode.common.Barcode { *; }
28-

app/src/classic/java/com/abhi/gcsfortasker/ClassicUtils.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="oval">
4+
<solid android:color="@color/yellow" />
5+
</shape>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3+
<corners android:radius="@dimen/boxCornerRadius" />
4+
<solid android:color="@color/textFieldBackground" />
5+
</shape>

0 commit comments

Comments
 (0)