[android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread Nobu Games
Just an educated guess. The documentation about the get method states, that 
alarm dates in the past will be triggered immediately, which is your case.

Following line might be the problem because of a possibly wrong 12 / 24 
hour conversion:

   cal.set(Calendar.*HOUR*, tpAddEvent.getCurrentHour());

What does tpAddEvent return? Is it in "hour of day" format? Then you need 
to rewrite the line to

   cal.set(Calendar.*HOUR*_OF_DAY, tpAddEvent.getCurrentHour());

If it is in 12 hour format, then you must also set AM/PM on your calendar:

   cal.set(Calendar.*AM_PM*, tpAddEvent.isAM() ? Calendar.AM : Calendar.PM);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread RichardC
Just one thing I spotted:
   Calendar.HOUR is the 12hour clock you also need to set  Calendar. AM_PM 
as well or use
   Calendar.HOUR_OF_DAY  which is the 24hour clock



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

RE: [android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread Tommy Hartz
tpAddEvent.getCurrentHour() returns 24 hour format.

 

I updated Calendar.HOUR to Calendar.HOUR_OF_DAY but I have the same issue

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 5:51 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Just an educated guess. The documentation about the get method states, that
alarm dates in the past will be triggered immediately, which is your case.

Following line might be the problem because of a possibly wrong 12 / 24 hour
conversion:

   cal.set(Calendar.HOUR, tpAddEvent.getCurrentHour());

What does tpAddEvent return? Is it in "hour of day" format? Then you need to
rewrite the line to

   cal.set(Calendar.HOUR_OF_DAY, tpAddEvent.getCurrentHour());

If it is in 12 hour format, then you must also set AM/PM on your calendar:

   cal.set(Calendar.AM_PM, tpAddEvent.isAM() ? Calendar.AM : Calendar.PM);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread Nobu Games
Ok... another thing I just noticed:

You are subtracting 1 day from your day of month, which would yield a date 
in the past. Is there a reason for that line of code:

cal.set(Calendar.*DAY_OF_MONTH*, dpEvent.getDayOfMonth()-1);

Maybe you confused that with the month. Months have the offset 0, not day 
of month.

On Monday, July 2, 2012 5:31:32 PM UTC-5, Tommy wrote:
>
> tpAddEvent.getCurrentHour() returns 24 hour format.
>
>  
>
> I updated Calendar.HOUR to Calendar.HOUR_OF_DAY but I have the same issue
>
>  
>
> *From:* android-developers@googlegroups.com [mailto:
> android-developers@googlegroups.com] *On Behalf Of *Nobu Games
> *Sent:* Monday, July 02, 2012 5:51 PM
> *To:* android-developers@googlegroups.com
> *Subject:* [android-developers] Re: AlarmManager not waiting to fire off 
> alarm...
>
>  
>
> Just an educated guess. The documentation about the get method states, 
> that alarm dates in the past will be triggered immediately, which is your 
> case.
>
> Following line might be the problem because of a possibly wrong 12 / 24 
> hour conversion:
>
>cal.set(Calendar.*HOUR*, tpAddEvent.getCurrentHour());
>
> What does tpAddEvent return? Is it in "hour of day" format? Then you need 
> to rewrite the line to
>
>cal.set(Calendar.*HOUR*_OF_DAY, tpAddEvent.getCurrentHour());
>
> If it is in 12 hour format, then you must also set AM/PM on your calendar:
>
>cal.set(Calendar.*AM_PM*, tpAddEvent.isAM() ? Calendar.AM : 
> Calendar.PM);
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

RE: [android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread Tommy Hartz
If I don't it gives me the following day for some reason.

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 6:43 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Ok... another thing I just noticed:

You are subtracting 1 day from your day of month, which would yield a date
in the past. Is there a reason for that line of code:

cal.set(Calendar.DAY_OF_MONTH, dpEvent.getDayOfMonth()-1);

Maybe you confused that with the month. Months have the offset 0, not day of
month.

On Monday, July 2, 2012 5:31:32 PM UTC-5, Tommy wrote:

tpAddEvent.getCurrentHour() returns 24 hour format.

 

I updated Calendar.HOUR to Calendar.HOUR_OF_DAY but I have the same issue

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 5:51 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Just an educated guess. The documentation about the get method states, that
alarm dates in the past will be triggered immediately, which is your case.

Following line might be the problem because of a possibly wrong 12 / 24 hour
conversion:

   cal.set(Calendar.HOUR, tpAddEvent.getCurrentHour());

What does tpAddEvent return? Is it in "hour of day" format? Then you need to
rewrite the line to

   cal.set(Calendar.HOUR_OF_DAY, tpAddEvent.getCurrentHour());

If it is in 12 hour format, then you must also set AM/PM on your calendar:

   cal.set(Calendar.AM_PM, tpAddEvent.isAM() ? Calendar.AM : Calendar.PM);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

RE: [android-developers] Re: AlarmManager not waiting to fire off alarm...

2012-07-02 Thread Tommy Hartz
You know what. I must have been looking at the wrong variable when using
getDayOfMonth. It seems to be working great now that I removed the - 1 after
it.

 

Sorry to have bothered everyone with such a dumb issue! Thanks for the help!
I hate those 1d10T errors J 

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 6:43 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Ok... another thing I just noticed:

You are subtracting 1 day from your day of month, which would yield a date
in the past. Is there a reason for that line of code:

cal.set(Calendar.DAY_OF_MONTH, dpEvent.getDayOfMonth()-1);

Maybe you confused that with the month. Months have the offset 0, not day of
month.

On Monday, July 2, 2012 5:31:32 PM UTC-5, Tommy wrote:

tpAddEvent.getCurrentHour() returns 24 hour format.

 

I updated Calendar.HOUR to Calendar.HOUR_OF_DAY but I have the same issue

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 5:51 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Just an educated guess. The documentation about the get method states, that
alarm dates in the past will be triggered immediately, which is your case.

Following line might be the problem because of a possibly wrong 12 / 24 hour
conversion:

   cal.set(Calendar.HOUR, tpAddEvent.getCurrentHour());

What does tpAddEvent return? Is it in "hour of day" format? Then you need to
rewrite the line to

   cal.set(Calendar.HOUR_OF_DAY, tpAddEvent.getCurrentHour());

If it is in 12 hour format, then you must also set AM/PM on your calendar:

   cal.set(Calendar.AM_PM, tpAddEvent.isAM() ? Calendar.AM : Calendar.PM);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en