I have a simple little flow/widget with a app task/end trigger, that intercepts "app_name" (and other values depending on what vars i initiate for which task) from all and any apps that start/end and stores it as glovar, (Among doing other stuff). However if i log a particular action from that app using the glovar, it will essentially replace all previously stored values on the widget that was asigned to the last executed app.
Instead of having so many different glovars, flows, etc, how can i make the one glovar do the same task for all apps?
Ive been playing around a bit with the "get" function because i asumed that would be an idea but ultimately i just come up blank!
--EDIT--
Typically my main issue is with my app count.
Lol i probably should had opened with this rather than all that mumbo jumbo haha.
I cannot figure out how to asign my app count var to all apps but with different count attached to the corresponding app name.
--EDIT AGAIN--
This is my script with the counter.
Init script:
Code: Select all
//APPLYING VALUES
global_app_name = app_name;
global_app_package = package_name;
global_transmitted_app_name = "";
global_received_app_name = "";
global_total_app_name = "";
//START APP BYTES
global_atransmitted = getByteSize(transmitted_bytes);
global_areceived = getByteSize(received_bytes);
global_atotal = getByteSize(total_bytes);
// START APP TIME
global_app_start_time = triggertime;
//STORE DATE FOR
date = getDate();
global_app_start_date =
"{date,dateformat,EEEE, dd/MMM/yyyy, hh:mm:ss a}";
//COUNTER
global_app_count =
if(global_app_count == null) 1
else global_app_count + 1;
Code: Select all
//APPLYING VALUES
global_app_name = app_name;
global_app_package = package_name;
//END APP BYTES
global_btransmitted = getByteSize(transmitted_bytes);
global_breceived = getByteSize(received_bytes);
global_btotal = getByteSize(total_bytes);
//CALCULATING TOTAL BYTES
global_transmitted_runtime =
(global_btransmitted - global_atransmitted);
global_received_runtime =
(global_breceived - global_areceived);
global_total_runtime =
(global_btotal - global_atotal);
//STORING TOTAL BYTES TO GLOVAR
global_transmitted =
getByteSizeString(global_transmitted_runtime);
global_received =
getByteSizeString(global_received_runtime);
global_total =
getByteSizeString(global_total_runtime);
//APP END TRIGGERTIME
global_app_end_time = triggertime;
//CALCULATING APP DURATION
global_app_runtime =
(global_app_end_time - global_app_start_time);
//CONVERTING DURATION VALUE TO STRING
global_app_runtime_format =
getDurationString(global_app_runtime);
//STORE DATE
date = getDate();
global_app_end_date =
"{date,dateformat,EEEE, dd/MMM/yyyy, hh:mm:ss a}";