Page 1 of 1

Send message when certain time past the hour is reached

Posted: Wed Dec 19, 2012 4:11 am
by rleiman
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.

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

Posted: Wed Dec 19, 2012 5:50 am
by dunbarx
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

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

Posted: Wed Dec 19, 2012 5:56 am
by Simon
Funny this just came up on the list today:
http://runtime-revolution.278305.n4.nab ... 58145.html

Simon

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

Posted: Wed Dec 19, 2012 11:01 am
by Klaus
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

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

Posted: Wed Dec 19, 2012 11:23 am
by rleiman
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.

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

Posted: Wed Dec 19, 2012 1:39 pm
by gpb01
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

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

Posted: Wed Dec 19, 2012 3:31 pm
by rleiman
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.

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

Posted: Wed Dec 19, 2012 5:10 pm
by gpb01
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

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

Posted: Wed Dec 19, 2012 5:22 pm
by gpb01
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

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

Posted: Wed Dec 19, 2012 8:08 pm
by rleiman
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?

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

Posted: Wed Dec 19, 2012 8:53 pm
by gpb01
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

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

Posted: Thu Dec 20, 2012 1:49 am
by Simon
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

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

Posted: Thu Dec 20, 2012 3:32 am
by rleiman
:lol: