a cell based location api

by error on line 1

Version 1 (October 13, 2020)

Download (71 downloads)

this flow serves as a module that handles the persistent storage management of cell-based location profiles.
it can be called with a payload dictionary
{"action": ACTION, "location": LOCATION}

it handles the actions
where PUT and DELETE require LOCATION.

the api reads or modifies a local and exportable json-file with location names as keys and arrays of cell tower ids as values.
GET iterates through the imported object and returns the location that contains found cell towers or null.
PUT sets or updates the array of cell towers on the given LOCATION and returns the initial location.
DELETE removes LOCATION from the json-file and always returns null.
return happens as a broadcast.

to integrate this api into another flow use the "start flow"-block passing the respective payload with action and location, and receive the broadcast returning the dictionary
{"location": CURRENTLOCATION}. set the awaiting action to "automate.myflow.intent.action.LOCATION_API" and assign the variable name to the dictionary with broadcast extras, e.g. result having result["location"].

set up the storage file once in the second block. make sure the calling flow is able to handle occasionally null-returns. decisions what to do also belong there.

by erroronline.one