Using checkbox to enable eventlistener
- by Lefty
I have looked for a solution to this for days and days. The examples I found don't make sence to me, probably because I am both old and new (old to life and new to android/jave).
I would like to add a checkbox to my preference activity that would either enable or disable receivers. This is for a service which will run in the background, at boot completed, and will depend on two things 1)is the preference true and 2) is wifi enabled.
So it would work something like this;
user turns on phone
boot completed checks if receivers are enabled (set by checkboxpreference)
if checkboxpreference is true - looks for wifi
if wifi is true - registers receivers
Also required would be if wifi or checkboxpreference goes "false", unregister receivers.
Thanks