Calendar cal = Calendar.getInstance(); // 获取日历的一个实例
cal.setTimeInMillis(starttimestamp); // 设置闹钟时间
Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM); //设置一个action为闹钟
intent.putExtra(AlarmClock.EXTRA_HOUR, cal.get(Calendar.HOUR_OF_DAY));// 设置时间“小时”
intent.putExtra(AlarmClock.EXTRA_MINUTES, cal.get(Calendar.MINUTE));//"分钟"
intent.putExtra(AlarmClock.EXTRA_MESSAGE, "hello");//“内容”
intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true);//“跳过ui”
context.startActivity(intent);//启动