Notification??

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Notification??

Post by ahmedinvent24BUSGdU9 » Sat Apr 13, 2013 3:40 pm

Hello :D
I was searching for how to make a local notification.
I found this code in the lessons :D

Code: Select all

on mouseUp
   local tCurrentTime, tNotificationTime, tAlertBody, tAlertButton, tAlertMessage, tSound
   put the seconds into tCurrentTime
   
   put field "alertbody" into tAlertBody
   put field "alertbutton" into tAlertButton
   put field "message" into tAlertMessage
   put tCurrentTime + word 1 of field "seconds" into tNotificationTime
   put the hilite of button "sound" into tSound
    
   mobileCreateLocalNotification tAlertBody, tAlertButton, tAlertMessage, tNotificationTime, tSound
end mouseUp
That was great!

But my Question is how to make it notify at a specific day and time for example, 17/4/2013 at 4:07 PM!
And how to change the notification icon :D

Thanks

Ahmed F.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Notification??

Post by jmburnod » Sat Apr 13, 2013 4:05 pm

Hi Ahmed,
Be careful about format date
17/4/2013 don't exist
use month/day/Year
4/17/2013

I think you need a pending message to check the time
something like that (no tested)

Code: Select all

local sAlertTime
on startCheckTime
   put fld "myAppointment" into sAlertTime
   convert sAlertTime to seconds
   send "doCheckTime" to me in 10 milliseconds
end startCheckTime

on doCheckTime
   if the seconds = sAlertTime then
      -- do what you want
   end if
   if doCheckTime is not in the pendingmessages then
      send doCheckTime to me in 60 seconds
   end if
end doCheckTime

on stopPending pPending
   repeat for each line aLine in the pendingmessages
      if aLine contains pPending then
         cancel item 1 of aLine
      end if
   end repeat
end stopPending
and don't forget

Code: Select all

on closecard 
   stopPending doCheckTime
end closecard
Sorry no idea to change the notification icon
Best regards
Jean-Marc
https://alternatic.ch

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: Notification??

Post by ahmedinvent24BUSGdU9 » Sat Apr 13, 2013 4:23 pm

Hi Jean-Marc
what I'll put

Code: Select all

 if the seconds = sAlertTime then
      -- do what you want
   end if
? :|

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Notification??

Post by jmburnod » Sat Apr 13, 2013 4:33 pm

Hi Ahmed
Something equivalent of your mouseup script I think
and sorry
not

Code: Select all

   if the seconds = sAlertTime then
but

Code: Select all

   if the seconds > sAlertTime then
https://alternatic.ch

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: Notification??

Post by ahmedinvent24BUSGdU9 » Mon Apr 15, 2013 1:56 pm

Hi Jean-Marc

Can you please upload a sample stack for this :D
Please I need it really because I will make it a birthday gift for my Brother :)

Best Regards

Ahmed F.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Notification??

Post by Dixie » Mon Apr 15, 2013 2:32 pm

I'm confused... I suspect this is for mobile, yet it is in the 'Commercial Developers' section of the forum.. So, the question is what's it for 'mobile' or the desktop ?

Dixie

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Notification??

Post by jmburnod » Tue Apr 16, 2013 10:38 pm

Hi Ahmed,

Just add an answer dialog when time id over

Code: Select all

on doCheckTime
   if the seconds = sAlertTime then
      answer "Happy birthday Brother"
   end if
   if doCheckTime is not in the pendingmessages then
      send doCheckTime to me in 60 seconds
   end if
end doCheckTime
Best regards
Jean-Marc
https://alternatic.ch

Post Reply