Posts

Showing posts with the label clock

New alarm with different data overrides already set alarm

Image
Clash Royale CLAN TAG #URR8PPP New alarm with different data overrides already set alarm I'm creating a simple app that will turn my wifi off/on at specified time in future. For example I have wifi on and I want to switch its state (turn it off) at 10PM and switch back and 8 AM (Turn on). To do that, I've written some block of code which has one bug. Well, when I set first alarm (let's accord to the example above) at 10PM and second at 8AM only the second one will fire. According to the answer here: Editing scheduled pending intends about pending intents I checked those alarms' pending intents while setting them and they were different . Okay, I'll provide some code, I will not give whole bunch of code to set up calendar because the bug is not there. WiFi.class //This class also stores and loads scheduled alarm from database, //that's why here is variable Uri = mUri. private void setAlarm(){ ContentValues values = new ContentValues(); values.put(Al...