The initial tutorial was over 2500 words long, there is no way anyone would read through that slog, therefore, a final Reward Cards Tasker Project has been redesigned to make it more compressed. It’s slightly different from the video showcase. I skipped the multiple cards part and copy the code/ID option to make this tutorial simpler. If you wish to retain this functionality both versions of the project are provided in the file, while the video explains the more robust project. This should keep things simpler, and easier to understand.
Prerequisites for Reward Cards Tasker Project
The first step is to turn my reward cards into a digital version. I found a great app for that: Barcode Generator. It’s simple, scan the barcode or QR code and the app will give you an option to save it as png/jpg and save the decoded number. Save both. While traditional barcodes can be used ‘as is’ QR codes need editing to fit the notification.
Open QR codes in SnapSeed, I’m particular about the app, as it comes with an ‘expand’ function. Expands allows you to increase the size of a canvas. Be sure to select the edges to be white and repeat the action three times to get the ideal padding around the picture. Organize your files and name it accordingly. It will help to navigate to the files later.
Next up, I will need logos for each shop I have a reward program for. A quick Google Image search will get you the results needed. The pictures used by me has been set to 2:1 ratio (1000:500). As with the barcodes, I will keep the shop logos in a separate folder.
Reward Cards Tasker Project
Now that we have everything ready, it’s time to build a data structure. I used 3 arrays to store the all the information in. (More arrays is used to have additional features – see the video)
Array Name | Contains |
%ShopNames() | Names of shops: tesco,morrisons,paperchase etc |
%ShoppingPaths() | Paths to barcodes: /sdcard/path/tesco.png, etc |
%ShopIcons() | Paths to shop icons: sdcard/path/tesco.png, etc |
Here is how the task should look like (My values are random):
Create AutoNotification Tile (optional)
Feel free to skip to the next chapter if you don’t want to use the tile to manually trigger the card selection screen. You can also pick another way (ie: task shortcut) to open this up.
AutoNotification Tiles are available on Android 7. To create a tile, create a new task and use AutoNotification Tile action to go through the config. This is a one-time setup and the only thing you must pay attention to is the issued command: shop_button=:=showdialog.
You can delete the task once the setup is complete.
Shop Buttons Actions Profile
This profile will handle the AutoTools Web screen and a notification that you are in the shopping center. Each AutoNotification command will share the same prefix shop_button.
Display all rewards – WebScreen Dialog
Let’s start with an action that can display all the cards. AutoTools plugin is great for displaying content on your screen. I’m using this action to show all the shops.
If you have your preferred way of displaying the content feel free to override this. Be mindful that each card triggers a specific command. When a card has been pressed a command: shoppingcard=:= tesco (morrisons,bandq..etc) is issued. Please modify the command prefix and card command accordingly.
Shopping center notifications
While we are working on this task, let’s attach a context that will capture the Google notification that says Retail park or Shopping center. Be aware that you should monitor your notifications to make sure, that words used in the filters are correct. This notification will prompt a new notification with a button to open our AutoTools Dialog. The AutoNotification trigger checks the title of the Google notification for
Retail|Shopping
and issues the notification. This notification is canceled in the same task when button issuing command shpu_button=:=showdialog is pressed. See abbreviated description of the profile
Show Shopping Barcode – The Main Task
This is the main task. It is triggered by three different profiles so let’s take a look at the triggers.
Google Location notification come in two flavors. This means we have to check both fields %antitle and %antext against our shop names. Our AutoNotification Event filter should look like this:
Tesco|Morrisons|B&Q
Look up the exact spelling of your shops on Google Maps to make sure you can intercept it correctly.
The 3rd trigger is the AutoApps command issued by the AutoTools Dialog we have created earlier. The command looks like this: shoppingcard=:=shopname. The name of the shop will be used in %aacomm later on in this task to display the correct barcode.
A1-A6
These actions are linked to Google Card notifications and set a local variable %shoplocation to a specific name. I can’t use the default %antext/%antitle variables as some shops contain not compatible characters for paths to files etc. This part runs only if %antitle is set (it is skipped if there is no notification).
A7
This segment is used when the trigger is a notification. If %antitle is set I want to set a new variable %ShopPicture that will contain a number – index of the element from the array that contains the shop names %ShopNames()
%ShopNames(#?~R%shoplocation)
Thanks to an excellent find by r/RatchetGuy we can search the arrays and return an index value that matches the specific regex. What it means that if my %shoplocation = tesco searching the array for a matching entry will return number 1 (I stored Tesco as the first element of my array).
A8
The same as above, but the segment is used when the barcode is triggered from a dialog. The %shoplocation has been substituted by %aacomm.
A9
The barcode notification. This should contain:
- Icon: %ShopIcons(%ShopPicture)
- Picture: %ShoppingPaths(%ShopPicture)
Feel free to modify the rest to your liking. As you can see barcodes and QR codes are set based on the index value set previously and the information is pulled directly from the arrays.
Conclusion
If you previously dismissed the shopping and places notification from Google, it will impact this project. Consider resetting your preferences to default in Google Now app. Reward Cards Tasker Project beats other apps like Stocard or Fidme available from the Google Play Store – it’s smarter, easier to use and more responsive. As I mentioned before the project file contains both versions of this project feel free to use either of them.
Project Download
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.