111

原创 2016年08月30日 15:09:31
<pre name="code" class="java">public class AlarmManager
{
    private static final String TAG = "AlarmManager";

    public static final int RTC_WAKEUP = 0;

    public static final int RTC = 1;

    public static final int ELAPSED_REALTIME_WAKEUP = 2;

    public static final int ELAPSED_REALTIME = 3;

    public static final long WINDOW_EXACT = 0;

    public static final long WINDOW_HEURISTIC = -1;

    private final IAlarmManager mService;//IAlarmManager接口
    private final boolean mAlwaysExact;

    //构造函数
    AlarmManager(IAlarmManager service, Context ctx) {
        mService = service;

        final int sdkVersion = ctx.getApplicationInfo().targetSdkVersion;
        mAlwaysExact = (sdkVersion < Build.VERSION_CODES.KITKAT);
    }

    private long legacyExactLength() {
        return (mAlwaysExact ? WINDOW_EXACT : WINDOW_HEURISTIC);
    }

    public void set(int type, long triggerAtMillis, PendingIntent operation) {
        setImpl(type, triggerAtMillis, legacyExactLength(), 0, operation, null);
    }

    public void setRepeating(int type, long triggerAtMillis,
            long intervalMillis, PendingIntent operation) {
        setImpl(type, triggerAtMillis, legacyExactLength(), intervalMillis, operation, null);
    }

    public void setWindow(int type, long windowStartMillis, long windowLengthMillis,
            PendingIntent operation) {
        setImpl(type, windowStartMillis, windowLengthMillis, 0, operation, null);
    }

    public void setExact(int type, long triggerAtMillis, PendingIntent operation) {
        setImpl(type, triggerAtMillis, WINDOW_EXACT, 0, operation, null);
    }

    public void set(int type, long triggerAtMillis, long windowMillis, long intervalMillis,
            PendingIntent operation, WorkSource workSource) {
        setImpl(type, triggerAtMillis, windowMillis, intervalMillis, operation, workSource);
    }

    private void setImpl(int type, long triggerAtMillis, long windowMillis, long intervalMillis,
            PendingIntent operation, WorkSource workSource) {
        if (triggerAtMillis < 0) {
            /* NOTYET
            if (mAlwaysExact) {
                // Fatal error for KLP+ apps to use negative trigger times
                throw new IllegalArgumentException("Invalid alarm trigger time "
                        + triggerAtMillis);
            }
            */
            triggerAtMillis = 0;
        }

        try {
	    //定时任务实际上都由mService来完成,也就是说AlarmManager只是一个空壳  
	    //从上面的构造方法可以看出,这个mService是IAlarmManager类型的,而IAlarmManager是一个接口  
	    //如果了解AIDL应该知道IAlarmManager应该是一个AIDL接口  
            mService.set(type, triggerAtMillis, windowMillis, intervalMillis, operation,
                    workSource);
        } catch (RemoteException ex) {
        }
    }

    public static final long INTERVAL_FIFTEEN_MINUTES = 15 * 60 * 1000;

    public static final long INTERVAL_HALF_HOUR = 2*INTERVAL_FIFTEEN_MINUTES;

    public static final long INTERVAL_HOUR = 2*INTERVAL_HALF_HOUR;

    public static final long INTERVAL_HALF_DAY = 12*INTERVAL_HOUR;

    public static final long INTERVAL_DAY = 2*INTERVAL_HALF_DAY;

    public void setInexactRepeating(int type, long triggerAtMillis,
            long intervalMillis, PendingIntent operation) {
        setImpl(type, triggerAtMillis, WINDOW_HEURISTIC, intervalMillis, operation, null);
    }

    public void cancel(PendingIntent operation) {
        try {
            mService.remove(operation);
        } catch (RemoteException ex) {
        }
    }

    public void setTime(long millis) {
        try {
            mService.setTime(millis);
        } catch (RemoteException ex) {
        }
    }

    public void setTimeZone(String timeZone) {
        try {
            mService.setTimeZone(timeZone);
        } catch (RemoteException ex) {
        }
    }
}



                    

【iOS开发-111】自定义大头针Annotation以及2种导航划线的方法介绍

自定义大头针Annotation以及2种导航划线的方法介绍

python 读取目录下csv文件并绘制曲线v111

# -*- coding: utf-8 -*- """ Spyder Editor This temporary script file is located here: C:\Users\user...

44滑动(1)60(2)87(3)111(4)125(5)140(6)149(7)192(16)197(17)

44滑动(1)60(2)87(3)111(4)125(5)140(6)149(7)192(16)197(17)

uva111 lcs 但是和顺序是有关的

Background Many problems in Computer Science involve maximizing some measure according to constrain...

用Android实现串扫描操作,将带有“111”字符的输出1,否则输出0

大体思路就是,先写出一个editext用来获取文本内容,再写出一个textview用来显示我们同步生成的文本。 然后我们要调用系统的textWatcher的函数,然后会出现三个复习的子类: @Ove...

无法上csdn博客的解决方法&cxalloc.cpp(111)&程序可以单步调通,裸奔不行

最近这两天,我们实验室的CSDN博客上不去了,有且只有博客上不去,尝试了各种解决办法。。。修改DNS,使用代理等,不知道是不得法还是怎样,没用,昨天发现问题是域名解析重定向,然后就删了hosts文件的...

Q111:PBRT-V3系统概述

小编在这里想通过渲染一个简单的场景(比如,一个球),来看看: 从“系统读入场景描述文件”到“系统输出图形”的过程中,系统具体是怎么跑的。(内容适合有一定ray tracing基础的童鞋)〇、准备直接...

UVa 111 - History Grading 最长递增子序列 LIS

History Grading  Background Many problems in Computer Science involve maximizing som...
  • cyendra
  • cyendra
  • 2013年04月22日 16:10
  • 788

ERROR (ConnectionError): HTTPConnectionPool (Caused by <class 'socket.error'>: [Errno 111] Connecti

突然有一天使用 nova list  出现错误了 root@openstackcloud1:~# nova list ERROR: HTTPConnectionPool(host='openstac...

111高校毕业设计选题

北京大学计算机毕业设计选题(源码,论文,任务书,开题报告范例).rar http://dl.vmall.com/c0sxawjicg 北京财贸职业学院计算机毕业设计选题(开题报告,源码,论文,任务...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:111
举报原因:
原因补充:

(最多只允许输入30个字)