• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App that will adjust another apps variables

Yeshia

Lurker
I have a profile that activates whenever the display goes On or Off, triggering a task that counts how many times the screen was turned On/Off, then turns on or off the flashlight. Effectively allowing me to control the Torch with the power button. It works great. I also set a variable so I can change how many Screen On/Offs it takes to set off the task.

I then made it into an App with the AppFactory. I want it to run in the background, with no scene or GUI. I also would like to be able to adjust the variable that controls the number of clicks required. Am I able to make another App that does have a scene which would change the variable used by my flashlight-background-app?

If not, is there another way to accomplish changing a background apps variables? Thanks
 
No, variables are never global. This means an app cannot access another apps variables. This so called sandboxing is part of the security systems, built into the OS.

Sandboxing explained:
http://www.howtogeek.com/169139/san...rotecting-you-and-how-to-sandbox-any-program/

Why not use a scene?

Thanks for the info. I don't want to create a scene because I don't want a program popping up everytime it runs. I simply want the flashlight to turn on after X number of Screen On/Offs. If I have a scene, it always opens the scene whenever I trigger the program. I really just wanted this as a background service, and have some other way to update the settings. Thanks again
 
Thanks for the example. You are triggering the scene whenever the flashlight (or whatever event) is triggered?
I guess I was hoping to have the flashlight be background service. As it sits now, when I click 3 times, the flashlight goes on, and nothing else pops up. I was hoping to have a config app to control the variables such as number of clicks. I suppose that is simply not possible unless I store the variables in a text file of some sort?
 
The scene is only shown when the user wants tot change the settings. The scene IS your config interface!
 
The example has two tasks. The counter task is triggered when the profile conditions are met. It adds and counts until counter and trigger match, then it resets the counter and executes whatever you put in there.

The options task is the task that displays the scene to the user. It is this task that is executed when the project's icon is clicked.

The scene itself has 3 active objects. A toggle to activate or deactivate the profile, a number picker to set the number of power button presses (the trigger), and a quit button that closes the scene and applies the changes.

Hope this was more or less clear ☺
 
Back
Top Bottom