Page 2 of 2
Re: Push notifications
Posted: Wed Aug 21, 2013 8:04 pm
by Simon
Actually all you need is event day time.
"convert "9/1/13" to seconds"
Doesn't matter when you start.
Simon
Re: Push notifications
Posted: Wed Aug 21, 2013 11:41 pm
by Opaquer
That makes this so much easier! Here I was making it so that it would get the date of the event, then split it up by the /, then take the day and subtract it from the current day, and same for the month and year, and repeat

. Glad to know that there's a much easier way

!
Re: Push notifications
Posted: Thu Aug 22, 2013 12:03 am
by Simon
You can do a test for me.
Since I don't think you can cancel a notification once it's set on the device, can you add another notification at the same seconds with a payload of "This has been canceled"?
Simon
Re: Push notifications
Posted: Thu Aug 22, 2013 12:48 am
by Opaquer
What exactly is the payload and badge :S? I didn't quite get it when I was reading it :S. Also, there's the mobileCancelLocalNotification command, which seems like if you enter in the right syntax, it will cancel said notification. The command is "mobileCancelLocalNotification notification" Would it be the badge number, or the payload, or what :S?
Re: Push notifications
Posted: Thu Aug 22, 2013 1:27 am
by Simon
Ok wicked there is a cancel. Good news.
For the different alert... just fill them all and see where they end up.
Re: Push notifications
Posted: Thu Aug 22, 2013 1:36 am
by Opaquer
Which different alerts is that?
Re: Push notifications
Posted: Thu Aug 22, 2013 1:50 am
by Opaquer
Hmm. I'm having a bit of trouble with the convert to seconds. I've got:
Code: Select all
convert date() to seconds
put it into datesec
convert time() to seconds
put it into timesec
convert word 1 of eventtime to seconds
put it into eventsec
answer eventsec
if word 2 of eventtime = "PM" then
put eventsec+43200 into eventsec
end if
Which all mostly works. But for some reason, when I test it out with the time 10:10PM, it doesn't quite convert the time properly. Instead of using the time of the event, it's using the current time

. It's a problem with how I've used the it part of the code, isn't it

? Also, I can finally use the code tags

!
Re: Push notifications
Posted: Thu Aug 22, 2013 2:08 am
by Simon
Look up dateItems, in your app you don't have to use it but it's format can be converted to seconds
e.g.
convert "2013,8,21,17,56,0,4" to seconds
the items above are described in the dateItems.
Simon
Re: Push notifications
Posted: Thu Aug 22, 2013 4:50 am
by Opaquer
Hmm. I think for now I like the method I'm using. I just can't figure out why it's not working and using the time instead of the eventsec

Re: Push notifications
Posted: Thu Aug 22, 2013 6:33 pm
by jacque
It's hard to say why it's failing until we know what's in eventtime. What's the value?
Simon's right though, dateitems would do a better job. It handles all sorts of things automatically without any calculations.
Re: Push notifications
Posted: Thu Aug 22, 2013 11:51 pm
by Opaquer
Sorry, I realised last night that I forgot to include eventtime! I figured it out sort of though? Instead of using:
Code: Select all
convert word 1 of eventtime to seconds
put it into eventsec
I just eneded to use:
Code: Select all
put word 1 of eventtime into eventsec
convert eventsec to seconds
Not entirely sure why it works, but it seems to work now

!
Re: Push notifications
Posted: Fri Aug 23, 2013 7:23 pm
by jacque
I've had inconsistent results when I don't put the time/date into a variable before using the convert command. I think you just hit one of those. I always use this form:
Code: Select all
put the date into tDate
convert tDate to seconds
Re: Push notifications
Posted: Fri Aug 23, 2013 11:51 pm
by Opaquer
That could be it. Either way, I'm rather glad it works

. It was quite annoying when it wasn't working
