First, this topic requires: The design of an Android -based alarm clock software.
The implementation of the function is: can set the alarm through the interface setting up the background service process, when the trigger condition is met, the alarm response to the corresponding event.
Second, demand analysis
This topic realizes in the handset operating system Android Alarm Clock reminder function, carries conveniently, uses up flexibly, fast, the worry, is a practical mobile phone software. "Phone alarm Clock" can be run in the background, and can be the same as the normal alarm clock set multiple location alarm, there is a good human-computer interaction interface, you can edit, enable or disable, the key is that you can customize the operation to cancel the alarm.
(1) System architecture includes: Add alarm, set time, repeat, alarm reminder, return to home page.
(2) User interface design
Main Page
Cancel Alarm Page
Third, the code design
(1)
Main.xml Code
De-Alarm Code
(2) Code Analysis
The Alarmmanager class is used to develop alarm clocks, and the Alarmmanager class provides a way to access the system's timing services, which developers can set up in the program to be executed at some point in the future. When the Alarmmanager time is up, the intent object that was registered will be broadcast by the system, and then the target program can be started. The registered alarm clock is still retained when the device is asleep , optionally setting whether to wake the device, but the alarm will be cleared when the device is turned off and restarted.
When you need to use the Alarmmanager class while the program is running, you can get the Alarmmanager object through the Getsystemservice (Context.alarm_service) method of the Context object.
Demo for Alarm clock use: Com.example.android.apis.app.AlarmController There are two kinds of alarm clocks, one is disposable and one is repetitive.
Iv. Summary
In this process, I learned a lot of knowledge, such as the building and configuration of Android environment, Android architecture and basic formation, and I learned that the most important point is to use the existing resources to solve problems, in the library, on the network to find answers, can also ask the teacher or with the students to discuss with each other. Although, this software is currently running well, but I think the code is still very poor, in the whole project concept is not enough, user interface is not flexible, these problems need to be solved one by one. At the same time, the software can be further expanded, such as through the Android API to obtain location information, and set alarm alerts at designated locations, so that more powerful, bring users better experience and convenient life services.
---restore content ends---
Software for Android-based alarms