-1

I am creating a field tracking application it has a switch when it is clicked it starts location services but when the switch is turned off it stops the service, but i want to automate this as if the user does not turn off the switch it should turn off automatically at say 7 pm and also disable that switch when it is turned off until next day say 6 am. Pleas help as i am stuck at this from a week.

I have tried handlers.

mySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            punchIn();
        } else {
            punchOut();
            // I want to implement those features.
        }
    }
});

Please help in solving.

0 Answers0