AlarmManger不注日期的工作 [英] AlarmManger not working with date

查看:182
本文介绍了AlarmManger不注日期的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想使上述API 11提醒。
我做了所有事情和时间的工作也意味着
如果我设定的时间,它的工作,但如果我想提醒设置明天或任何一天
它不能够做到..
所以我把这个日历code设置报警这是工作。
随着时间的工作

Hi I am trying to make reminders above api 11. I did all things with and working on time also means if i set time , its working but if i want to set reminder for tomorrow or any day it is not able to do.. so i put this calender code to set alarm which is working. With time working

    Calendar calendar = Calendar.getInstance();

    // working time only
    calendar.set(Calendar.HOUR_OF_DAY, hour);
    calendar.set(Calendar.MINUTE, min);
    calendar.set(Calendar.SECOND, 00);
    AlarmBcastReceiver alarmBcastReceiver = new AlarmBcastReceiver();
    alarmBcastReceiver.SetAlarm(this, calendar);

现在,如果试图把迄今为止在这个日历。
这是行不通即。

Now if tried to put date in this calender. this is not working i.e.

    Calendar calendar = Calendar.getInstance();

    calendar.set(Calendar.DAY_OF_MONTH, day);
    calendar.set(Calendar.MONTH, month);
    calendar.set(Calendar.YEAR, year);

    // working time only
    calendar.set(Calendar.HOUR_OF_DAY, hour);
    calendar.set(Calendar.MINUTE, min);
    calendar.set(Calendar.SECOND, 00);
    AlarmBcastReceiver alarmBcastReceiver = new AlarmBcastReceiver();
    alarmBcastReceiver.SetAlarm(this, calendar, notiId);

我也试过来设置此
        //calendar.set(year,月,日,小时,分钟);
但它也不能正常工作。

I also tried to set this //calendar.set(year, month, day, hour, min); but it also not working.

推荐答案

您正在传递错误的飞蛾。你逝去的10和要测试十月。您将需要通过它考虑为0-11月 - 12月

You are passing wrong moth. You are passing 10 and want to test for October. You will need to pass it considering 0-11 for January - December.

这意味着,

您月份更改为9。

calendar.set(Calendar.MONTH, 9);

这将使十月报警日期。因此,进行修改和测试。

That will make the alarm date of October. So make changes and test.

参考

希望这有助于。

这篇关于AlarmManger不注日期的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆