This page describes the details of the "Record location into DB periodically" flow I created for Automate. Automate is an Android app for block style rapid programming.

Description

This flow consists of seven subflows, each corresponding to the seven different location providers accepted by "Location At" block.

This is a sample program that continuously retrieves the current location at intervals and records it in a table.

The SQLite database used is an external storage (possibly emulated) file named "automate.sqlite".

This flow creates a table named "location" in this file and records the output of the "Location at" block.

The seven subflows include a wait time of 'random(3600)' seconds, so they will not run excessively. Also, the "Location at" block is placed in a separate flow where duplicate invocations are prohibited so that it cannot be executed by more than one subflow at the same time. If the execution of the "Location at" block fails due to this restriction, it will attempt to execute again after a wait of 'random(100)' seconds.

Android SDK defines 5 types of ProviderProperties: ACCURACY_COARSE, ACCURACY_FINE, POWER_USAGE_HIGH, POWER_USAGE_LOW, and POWER_USAGE_MEDIUM. On the other hand, the "Location get" block in Automate defines seven types of location providers: Balanced, GPS, High accuracy, Low power, Network ,No power, and Passive. 7 subflows are defined in " The seven subflows correspond to the seven location providers accepted by the "Location get" block.