GithubHelp home page GithubHelp logo

cervy / android-alarmmanagerclock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loonggg/android-alarmmanagerclock

0.0 2.0 0.0 14.63 MB

设置闹钟的一个封装的比较全面的demo

Java 100.00%

android-alarmmanagerclock's Introduction

Android-AlarmManagerClock

设置闹钟的一个封装的比较全面的demo

前些时候,有人在我「非著名程序员」公众号的后台问我有没有设置闹钟的demo,我当时说承诺为大家写一个,一直没空,直到最近又有人跟我要,我决定抽时间写一个吧。确实设置闹钟是一个比较麻烦的东西。我在这里写的这个demo抽出来了封装了一个类库,大家直接调用其中的设置闹钟和取消闹钟的方法即可。可以设置每天的闹钟,周一到星期天之间多选的闹钟,也可以设置选择一次性闹钟,跟系统设置闹钟的方式基本差不多吧。

效果图

来看分析和讲解之前,先看看效果吧,效果图如下:

设置界面

闹钟提醒界面

使用方法介绍:

设置闹钟的方法:

setAlarm(Context context, int flag, int hour, int minute, int id, int
            week, String tips, int soundOrVibrator)

参数介绍:

@param flag 周期性时间间隔的标志,flag = 0 表示一次性的闹钟, flag = 1 表示每天提醒的闹钟(1天的时间间隔),flag = 2 表示按周每周提醒的闹钟(一周的周期性时间间隔)

@param hour 时

@param minute 分

@param id 闹钟的id

@param week week=0表示一次性闹钟或者按天的周期性闹钟,非0 的情况下是几就代表以周为周期性的周几的闹钟

@param tips 闹钟提示信息

@param soundOrVibrator 2表示声音和震动都执行,1表示只有铃声提醒,0表示只有震动提醒

取消闹钟的方法:

canceAlarm(Context context, String action, int id) 

参数介绍:

action:自定义广播的action

id:设置闹钟时的id

android-alarmmanagerclock's People

Contributors

loonggg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.