Record location into DB

by Takashi SASAKI (佐々木隆志)

Version 3 (January 18, 2023)

Download (60 downloads)

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

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

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 get" 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 get" 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.


See details at
https://tech-memo.notion.site/Record-location-into-DB-periodically-Automate-by-llamalab-com-21497e1b008d472198b017653895a83a