Locking a Card for a specific time slot & Reminding the user
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Locking a Card for a specific time slot & Reminding the user
Hi!
I'm pretty new in LiveCode and I tried to find a solution in this forum but didn't find one in an old topic. I hope I didn't miss something. But first of all excuse my bad english. I'm not a native speaker.
I'm a dentist and I'm developing an app for my doctoral thesis. My app is a survey after a specific treatment. The answers get uploaded on my server and I can interpret them after that.
What is the important part in my app, is that I want the app to remind the user at a specific time that he has to answer my questions. When he gets reminded the user has 2 hours to answer the questions, otherwise it isn't possible anymore and he has to skip this round. All in all he has to answer the questions 10 times over a week.
If he still opens the app (outside this specific time slot) he shouldn't be able to answer the questions as the survey-card is locked.
So what I'm looking for is:
1) A reminder that pops up on the screen of the user just like an alarm clock, maybe additionally in the status bar.
2) Locking the card outside this specific time slot - and in those 2 hours that the user is able to answer the questions
Thank you so much in advance and please excuse my bad english.
I'm pretty new in LiveCode and I tried to find a solution in this forum but didn't find one in an old topic. I hope I didn't miss something. But first of all excuse my bad english. I'm not a native speaker.
I'm a dentist and I'm developing an app for my doctoral thesis. My app is a survey after a specific treatment. The answers get uploaded on my server and I can interpret them after that.
What is the important part in my app, is that I want the app to remind the user at a specific time that he has to answer my questions. When he gets reminded the user has 2 hours to answer the questions, otherwise it isn't possible anymore and he has to skip this round. All in all he has to answer the questions 10 times over a week.
If he still opens the app (outside this specific time slot) he shouldn't be able to answer the questions as the survey-card is locked.
So what I'm looking for is:
1) A reminder that pops up on the screen of the user just like an alarm clock, maybe additionally in the status bar.
2) Locking the card outside this specific time slot - and in those 2 hours that the user is able to answer the questions
Thank you so much in advance and please excuse my bad english.
Re: Locking a Card for a specific time slot & Reminding the
Hi Flo,
1. welcome to the forum!
2. YWe may know each other from the german forum, I gave an answer to your last question.
3. I do not develop for mobile, I don't even own or need) any mobile device, just an old iPod Touch
So i canot be of any help on specific mobile tasks, only LC in general, but this is a busy forum and
someone will surely chime in here soon!
Best
Klaus
P.S.
Dein Englisch ist super!
1. welcome to the forum!
2. YWe may know each other from the german forum, I gave an answer to your last question.
3. I do not develop for mobile, I don't even own or need) any mobile device, just an old iPod Touch
So i canot be of any help on specific mobile tasks, only LC in general, but this is a busy forum and
someone will surely chime in here soon!
Best
Klaus
P.S.
Dein Englisch ist super!
Re: Locking a Card for a specific time slot & Reminding the
First, I'd agree with Klaus, your english is very good, probably better than mine
I know that specialFolderPath works on mobile and other devices, so it could be used to save this pref file, where you could then read it in and compare the dates opened after words against the original date, setting up reminders for each goal your looking for generically using a case/switch statement and comparing it to the date read in.
I hope this helps you, if not I am sure as Klaus mentioned others will chime in
I also do not develop for mobile, but if I were trying to accomplish these tasks specifically, I would probably use the date function (dictionary) to save the time and date the application were opened for the first time (check for the file in the preOpenCard or preOpenStack, if it exists then read it in, else write it out), either to a stack file, or a preferences (plain text or binary) file.Flo92 wrote:So what I'm looking for is:
1) A reminder that pops up on the screen of the user just like an alarm clock, maybe additionally in the status bar.
2) Locking the card outside this specific time slot - and in those 2 hours that the user is able to answer the questions
I know that specialFolderPath works on mobile and other devices, so it could be used to save this pref file, where you could then read it in and compare the dates opened after words against the original date, setting up reminders for each goal your looking for generically using a case/switch statement and comparing it to the date read in.
I hope this helps you, if not I am sure as Klaus mentioned others will chime in
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Locking a Card for a specific time slot & Reminding the
There's no good mechanism on Android to put up an overlay over another app. If your app is running you can, of course, show a dialog or a group to notify the user.Flo92 wrote:So what I'm looking for is:
1) A reminder that pops up on the screen of the user just like an alarm clock, maybe additionally in the status bar.
2) Locking the card outside this specific time slot - and in those 2 hours that the user is able to answer the questions
LC does have built-in notification capability though, which will put a notification into the status bar whether your app is running or not. You have a choice of remote or local notifications; all you need in this case is local which is much easier to implement. See "mobileCreateLocalNotification" in the dictionary. It includes a time parameter, so you'd calculate a 2-hour future time and set the notification to that. When the notification fires, it will send a message to your app "localNotificationReceived" which you can act on.
You could use that message to "lock" the card. There are probably a number of ways to do that, but maybe one of the easiest is to put all the card controls into a group and disable the group when the notification event arrives.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Locking a Card for a specific time slot & Reminding the
Now that is pretty slick.
See Flo? We told you someone who knows would pop in
See Flo? We told you someone who knows would pop in
Re: Locking a Card for a specific time slot & Reminding the
Thank you so much already! I'll try this out tomorrow. If I'm having any problems I'll definitely come back. Great community here
Re: Locking a Card for a specific time slot & Reminding the
Ok So I tried it with the mobileCreateLocalNotification-Code. The code itself works pretty good and also acting up on the localNotificiationReceived works.
BUT: When the LocalNotification (for example in 180 seconds) is sent and I turn off the device and turn it on again, the LocalNotification seems to be deleted.
Is there any possibility to avoid that? So that LocalNotification works here?
BUT: When the LocalNotification (for example in 180 seconds) is sent and I turn off the device and turn it on again, the LocalNotification seems to be deleted.
Is there any possibility to avoid that? So that LocalNotification works here?
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Locking a Card for a specific time slot & Reminding the
If the phone is sleeping the notification should persist. But if you power down and then restart, I think the OS clears all notifications (but I'm not sure.)
Edit: I just checked, and yes, Android deletes notifications after a restart.
Edit: I just checked, and yes, Android deletes notifications after a restart.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com