定时开关机

int[] mOffTime = {2020,3,22,8,0}; //{年,月,日,时,分}
int[] mOnTime = {2020,3,22,22,30}; //{年,月,日,时,分}
Intent mIntent = new Intent("android.intent.action.set.rtc.poweronoff");
mIntent.putExtra("timeon",mOnTime); //开机时间,见上面数组定义
mIntent.putExtra("timeoff",mOffTime); //关机时间,见上面数组定义
mIntent.putExtra("enable",true); //true 开启,false 关闭
sendBroadcast(mIntent);
文档更新时间: 2021-04-29 18:16   作者:Aeeditor