[GUIDE] Bundle assets and files into Factory/Kids apps.

Hello Tasker community. Today I want to share a pure tasker project, which can bundle any number of files(assets), of any size while exporting your factory app. The factory app will then extract those resources whenever ExtractAssets task is called.

Edit: Import error is fixed, make sure that BundleAssets scene is not in project while importing, or delete it after import

But first lets look into what what other solutions can be used to carry files with kids app.

  1. Storing base64 value of file in a variable.
    Base64 value can be found using "Read Binary" action. But this a limitation that variables have a limit of how long the string can be, so it was suitable for small files only.

  2. Using Tasker kids file app on play store. Uses similar principle as above but requires an extra plugin app to be installed by kids app user. Supports bigger files.

#About this project

####How it works? Setting a file as font in Tasker scene will export it as asset. Pros of this project is its pure tasker, no file size/number limit and extremely easy to use.

####How to use this project.
Import the project from TaskerNet or download Xml file

TL;DR: Just execute "BundleAssets" task, select files to pack with apk. Call "ExtractAssets" task using the "Perform Task" action from your kids app main task. Then export your project/task as App. Thats it, easy and simple

Also PLS USE THE LATEST TASKER VERSION (tested on 5.12.18), old versions didn't have a pick file input


Read further for more detailed info on usage

There is no size limit of number or size of assets that can be carried by your kids app with this project.(100 mb apk file size limit applies if you want to publish your apk on play store)

About the task - BundleAssets

All you have to do is execute , BundleAssets task and "Add" the asset files to be added. Then add the following action in your kids app main task when you want to extract assets.

 Perform Task "ExtractAssets"

   %par1 : 

   %par2 :

Additonal Info

  1. Clear button of list dialog clears the temporary directory and clears the list. Default temporary directory is Tasker/tmp folder

  2. Long press any item in list dialog to enter Advanced edit mode.

  3. You can add an entire folder as asset by long pressing it in file picker dialog.

  4. Advanced edit mode Contains Batch delete(remove from list) , Batch change extract mode and Batch extract path settings.

  5. Batch extract path setting. Note: The default[D] extraction path is same as the one you added, for example if you added the file from download folder, it will by default be extracted to download folder of user. In this setting can specify a custom[C] path to extract.

  6. Batch mode setting

The number in bracket denotes the mode of extraction

[0]= extract these assets on every run.

[1]= extract these assets only on 1st run of app after installation, subsequent run will not extract assets.

[2]= extract these assets on first run and after application update.(version code increase) (default mode)

  1. About table.txt and Index Name

Index Name of your asset can be found from the table.txt file in %temporary_dir (by default it is "Tasker/tmp"). This file is formed after the BundleAssets is run. In this file the headers are

Index Name|original_name|original_path|path_to_extract|mode|checksum of file.

About the task - ExtractAssets

Call this task using the "Perform Task" action from your kids app task. Make sure you have run the Bundle Assets task first. Then simply export your project/task as App.

There are some modifiers which can be passed as %par1 while calling this task.

Case 1: No parameters passed.

All assets will be extracted, to the [D] default location, or [C] custom location if specified in "BundleAssets task". The extraction will obey the "mode of extraction" as set in BundleAssets task.

 Perform Task "ExtractAssets"

   %par1 :  

   %par2 :  

Case 2: If you want to explicitly extract a single or multiple files (regardless of the mode)

Pass the Index name of file in %par1. For multiple files pass the Index name seperated by pipe symbol( | ) . Index name of file can be found from table.txt located in temporary directory (default /sdcard/Tasker/table.txt). In table.txt the first column (delimiter |) is the Index name.

For example if you want to bundle and extract a file work.png that is in your downloads folder. Run the BundleAssets task. Open the table.txt and check the Index name. For files with same name you can differentiate using the path in 3rd column of table.txt. Lets say its index name is "Tasker.tmp.3".

 Perform Task "ExtractAssets"

   %par1 :Tasker.tmp.3

   %par2 :

For extracting multiple files the format will be

 Perform Task "ExtractAssets"

   %par1 :Tasker.tmp.1|Tasker.tmp.13|Tasker.tmp.2

   %par2 :  

These assets will be extracted, to the [D] default location, or [C] custom location if specified in "BundleAssets task".

Finally export your kids app.

Posted May 14, 2021, 10:47 PM UTC · edited

2916
Loading comments…