private static void enableAlertPowerOn(Context context, final Alarm alarm, final long atTimeInMillis) {
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.cancel(MyPendingIntent);
Log.d(TAG, "** setAlert id " + alarm.mId + " atTime " + atTimeInMillis);

// Intent intent = new Intent(ALARM_ALERT_ACTION);
// Intent intent = new Intent(context, SchedulePowerOff.class);
Intent intent = new Intent(context, com.borqs.schpwronoff.SchPwrOnReceiver.class);

// XXX: This is a slight hack to avoid an exception in the remote
// AlarmManagerService process. The AlarmManager adds extra data to
// this Intent which causes it to inflate. Since the remote process
// does not know about the Alarm class, it throws a
// ClassNotFoundException.
//
// To avoid this, we marshall the data ourselves and then parcel a plain
// byte[] array. The AlarmReceiver class knows to build the Alarm
// object from the byte[] array.
Parcel out = Parcel.obtain();
alarm.writeToParcel(out, 0);
out.setDataPosition(0);
intent.putExtra(ALARM_RAW_DATA, out.marshall());

PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);

MyPendingIntent = sender;
am.set(5 , atTimeInMillis, sender);
Log.d(TAG, "Alarms.enableAlertPowerOn(): setAlert id " + alarm.mId + " atTime " + atTimeInMillis);
long now = System.currentTimeMillis();

// setStatusBarIcon(context, true);

Calendar c = Calendar.getInstance();
c.setTime(new java.util.Date(atTimeInMillis));
// String timeString = formatDayAndTime(context, c);
// saveNextAlarm(context, timeString);
}

rtc 关机闹钟1 app层的更多相关文章

  1. rtc关机闹钟7 jni层 com_android_server_AlarmManagerService

    frameworks/base/services/core/jni/com_android_server_AlarmManagerService.cpp int AlarmImplAlarmDrive ...

  2. rtc关机闹钟3 IAlarmManager

    vim framework/base/core/java/android/app/IAlarmManager.aidl import android.app.AlarmManager;import a ...

  3. [RK3288][Android6.0] 调试笔记 --- 录音音量从HAL到APP层会变小问题【转】

    本文转载自:http://blog.csdn.net/kris_fei/article/details/72783843?locationNum=9&fps=1 Platform: Rockc ...

  4. rtc关机闹钟5 AlarmManager研究

    AlarmManager研究 侯 亮 转自 http://blog.csdn.net/codefly/article/details/17058425 1.概述 在Android系统中,闹钟和唤醒功能 ...

  5. Android 从上层到底层-----app层

    CPU:RK3288 系统:Android 5.1 功能:上层 app 控制 led 亮灭 开发板:Firefly RK3288 MainActivity.java package com.aaron ...

  6. rtc关机闹钟2 Alarm manager

    public void set(int type, long triggerAtMillis, long windowMillis, long intervalMillis, PendingInten ...

  7. rtc关机闹钟6 AlarmManagerService研究

    这个是 private void setLocked(int type, long when) { if (mNativeData != 0) {            // The kernel n ...

  8. rtc关机闹钟4 AlarmManagerService.java

    vim base/services/core/java/com/android/server/AlarmManagerService.java AlarmManager 调用 IAlarmManage ...

  9. Android Native Binder,在Native层与App交互数据

    Binder底层是基于C实现的,因此可以作为Native进程与App层交互数据的渠道.其应用场景为:Native Service.Hal驱动设置.应用层JNI服务等. Android 4.4引入SEA ...

随机推荐

  1. 解决对含有第三方jar包的项目打包出现java.lang.NoClassDefFoundError问题

    用eclipse普通的打包方式,对含有第三方jar包的项目进行打包.调用方法后一只出现java.lang.NoClassDefFoundError问题. 从网上搜寻,很多都是在MANIFEST.MF文 ...

  2. Android 秒级编译 Freeline

    http://mp.weixin.qq.com/s?__biz=MzA4NTQwNDcyMA==&mid=2650662410&idx=1&sn=c654fa7b0cc8c91 ...

  3. sqoop的使用

    1.sqoop的安装 1.1 与hadoop和hive的集成,修改/opt/cdh/sqoop-1.4.5-cdh5.3.6/conf/sqoop-env.sh 文件

  4. 1. C语言中的数据结构.md

    C语言内建数据结构类型 整型 整型数据是最基本的数据类型,不过从整形出发衍生出好几种integer-like数据结构,譬如字符型,短整型,整型,长整型.他们都是最基本的方式来组织的数据结构,一般是几位 ...

  5. log4net一些配置说明

    <configuration> <configSections> <section name="log4net" type="System. ...

  6. Query Designer:Variable 变量

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. Servlet开发详解

    一.Servlet简介 Servlet是sun公司提供的一门用于动态web资源的技术 sun公司在其API中提供了一个Servlet接口,用户若想开发一个动态web资源,需要完成两个步骤: 编写一个J ...

  8. 事件委托和JQ事件绑定总结

    事件委托: 比喻:事件委托的事例在现实当中比比皆是.比如,有三个同事预计会在周一收到快递.为签收快递,有两种办法:一是三个人在公司门口等快递:二是委托给前台MM代为签收.现实当中,我们大都采用委托的方 ...

  9. LINQ之路 7:子查询、创建策略和数据转换

    在前面的系列中,我们已经讨论了LINQ简单查询的大部分特性,了解了LINQ的支持计术和语法形式.至此,我们应该可以创建出大部分相对简单的LINQ查询.在本篇中,除了对前面的知识做个简单的总结,还会介绍 ...

  10. google play下载apk

    http://apps.evozi.com/apk-downloader/ 输入apk下载地址