Send message when certain time past the hour is reached

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Send message when certain time past the hour is reached

Post by rleiman » Wed Dec 19, 2012 4:11 am

Hi Everyone,

I would like to make an IOS app that runs in the background and check the current time and have it send a message when 15 past the hour has been reached.

Can you show me the coding to make this work?

Thanks.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Send message when certain time past the hour is reached

Post by dunbarx » Wed Dec 19, 2012 5:50 am

Hi.

Try something like this in a button somewhere:

Code: Select all

on mouseUp
   doItIn15after
end mouseUp

on doItIn15after
   set the itemDel to ":"
   if word 1 of item 2 of  the short time = "15" then
      doYourThing
      exit to top
   end if
   send "doItIn15after"  to me in 1 seconds
end doItIn15after

on doYourthing
  answer "See how this works?"
end doYourthing
Now, do you see how this works?

Craig Newman

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Send message when certain time past the hour is reached

Post by Simon » Wed Dec 19, 2012 5:56 am

Funny this just came up on the list today:
http://runtime-revolution.278305.n4.nab ... 58145.html

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Send message when certain time past the hour is reached

Post by Klaus » Wed Dec 19, 2012 11:01 am

Hi friends,

are you sure that Livecode can really run iOS apps in the background?
I thought this is not (yet) supported and an app just quits?!


Best

Klaus

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Send message when certain time past the hour is reached

Post by rleiman » Wed Dec 19, 2012 11:23 am

Thanks for the replies and help.

I do hope LiveCode can handle background processing because I want to make a reminder app on IOS with it.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Send message when certain time past the hour is reached

Post by gpb01 » Wed Dec 19, 2012 1:39 pm

rleiman wrote:Thanks for the replies and help.

I do hope LiveCode can handle background processing because I want to make a reminder app on IOS with it.
Hi rleiman,
only very few kind of applications are allowed to run in background by Apple and ... for sure, NOT reminder Apps (note, I say by Apple, not because using LiveCode) ... :)

The only solution is this one : http://lessons.runrev.com/s/lessons/m/4 ... ifications ... using the "Local Notifications" ;)

Guglielmo

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Send message when certain time past the hour is reached

Post by rleiman » Wed Dec 19, 2012 3:31 pm

Hi,

Thanks for the reply. Looks like I may be able to use the local notifications if I can do it without showing a dialog box because I want to play an audio file at that time and not show the user any messages.

I hope this is possible to do.

If it is, then I will purchase a "Pay as you go" license.

Thanks.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Send message when certain time past the hour is reached

Post by gpb01 » Wed Dec 19, 2012 5:10 pm

rleiman wrote:Hi,
Thanks for the reply. Looks like I may be able to use the local notifications if I can do it without showing a dialog box because I want to play an audio file at that time and not show the user any messages.
I hope this is possible to do.
If it is, then I will purchase a "Pay as you go" license.
Thanks.
Hi rleiman,
mmm ... I don't think that this is possible and, I repeat, not because LiveCode, but because the "privacy" and "security" limits that Apple imposes !

As you can read on the linked tutorial, if the application is running when the notification is received it can handle the display of the notification as required. If the app is not running then the user is notfied and can choose what action to take ...

If the App is not running ... ONLY the user can authorize the start ... :(

Guglielmo

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Send message when certain time past the hour is reached

Post by gpb01 » Wed Dec 19, 2012 5:22 pm

Another solution is ... declaring the App as "Supported Background Tasks" ("audio" is one of the seven possibles background task class) but ... subject to strict Apple approval process for this kind of applications (... they are quite strong on background tasks).

More ... to create a "Long-Running Background Tasks" you have to modify the "Setting.plist" inside LiveCode and ... is an "RunRev unsupported" change.

I suggest you to read this Apple document ...
http://developer.apple.com/library/ios/ ... sFlow.html

Guglielmo

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Send message when certain time past the hour is reached

Post by rleiman » Wed Dec 19, 2012 8:08 pm

Wow. That's overwhelming.

Since I'm a beginner I thought a simple app that will play an audio file at 15 past the hour would be easy to do. I was hoping to let the user start the app and leave it alone while the user goes and does other things on the phone and when 15 past the hour is reached the audio file will play.

Will the app quit if the user move focus away from the running app?

I guess another question I have is if the user restarts the phone is there a way to have the app automatically restart without any intervention from the user?

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Send message when certain time past the hour is reached

Post by gpb01 » Wed Dec 19, 2012 8:53 pm

Yes ... unfortunately is not something really for a "beginner" ... but really, you have to read and to understand the linked Apple page about the "Applications Flow" (... and the different "state" ... Running, Suspended, Background, etc) and what is allowed and what not ;)

iOS is easy for users, but not for programmes ... :D

Guglielmo

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Send message when certain time past the hour is reached

Post by Simon » Thu Dec 20, 2012 1:49 am

I guess if a sound file is allowable as a background task then I think working this sort of backward may help.
Make a 1 hour long audio track with 59 minutes of silence. Of course you would have to add start times based on current time to get the :15 alarm.
Doubt you can get that pass Apple. But I'm only giving a possible solution to the current task. :D

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

rleiman
Posts: 56
Joined: Fri Dec 14, 2012 11:28 am
Contact:

Re: Send message when certain time past the hour is reached

Post by rleiman » Thu Dec 20, 2012 3:32 am

:lol:

Post Reply