我正在尝试为特定日期和时间设置警报,但到目前为止我一直没有成功。作为一个实验,我试图将它设置为今天上午 10:04,如下所示:
Calendar cal = Calendar.getInstance();
// int currtYear = cal.get( Calendar.YEAR );
// int minute = cnvrtStrg( splitTime[1] ) - 5;
// int hour = cnvrtStrg( splitTime[0] );
cal.setTimeInMillis( System.currentTimeMillis() );
cal.clear();
cal.set( 2012, 4, 10, 10, 4 );
Intent intent = new Intent( passing_info.this, alarm_receiver.class );
sender = PendingIntent.getBroadcast( this, 0, intent, 0);
am = (AlarmManager)getSystemService( ALARM_SERVICE );
am.set( AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),sender );
Toast.makeText( getApplicationContext(), "Alarm set",Toast.LENGTH_SHORT ).show();
我的设置方式正确吗?为什么这没有做任何事情?即它不响(接收器类振动电话)
谢谢
PS toast 消息出现在底部