How to write an app that will pop up at the alarm time like the clock app?

Hi,
I tried to develop an app for my personal use. My idea was to make a medicine reminder for me because I have the Parkinson decease and I have to take medicine every 3 hours. The app was meant to alarm 5 times every day: in the morning 9:00, 12:00, 15:00, 18:00 and 21:00. My app works now but it needs two features that I don’t know how to write: 1. how to make my app to stay alive e.g. to remember the alarm times and pop up like the clock app at the alarm time? (The second question in another topic)

import QtQuick 2.0
import Sailfish.Silica 1.0
import QtMultimedia 5.6

Page {
id: page
allowedOrientations: Orientation.All
Item {
id: palikka
}
Text {
text: “tango”;
font.pointSize: 44;
width: 140; height: 1500; x:180; y:200; color:“white”
Audio {
id: playMusica
autoLoad: true
volume: 0.5
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: {
playMusica.stop(1,1)
playMusica.source= “https://ais-sa2.cdnstream1.com/2202_128.mp3
playMusica.play(1,1)
}
}
}
Text {
text: “Mute”;
font.pointSize: 44;
width: 140; height: 1500; x:359; y:200; color:“white”
Audio {
id: stopMusic
}
MouseArea {
id: stopArea
anchors.fill: parent
onPressed: {
playMusica.stop(1,1) }
}
}
Text {
text: “news”;
font.pointSize: 44;
width: 140; height: 1500; x:690; y:200; color:“white”
MouseArea {
id: clockArea2
anchors.fill: parent
onPressed: {
playMusica.stop(1,1)
playMusica.source = “https://edge8.audioxi.com/NT
playMusica.play(1,1)
}
}
}

Timer {
interval: 10000
running: true
repeat: true
}
}

Well, “stay alive” is called “keep alive” here:

Maybe these are useful. “BackgroundJob” sounds like the one you want to use.

(Note: to display code correctly on this forum, either indent it by four spaces, or start and stop the code block with four backticks (````).

4 Likes

Me to, need to take medicine a few times a day, and I use calendar to remind me.
I actually can’t think of anything missing in calendar as a medicine reminder, so I would love to test your app. Please share your work. :slightly_smiling_face:

3 Likes

I have in my app a button: “take” When I finger-click that the app will reschedule the remaining alarms so that the second is 3 hours from the moment “take” (taken) was clicked and the third is 6 hours etc. If I wake up very early or late then 9 is not my first drug moment on that day but it is important to keep the time between in 3 hours. Also I have this kind of feature.: the app will start playing of the net-radio with a very low volume couple of minutes before the take-time and the volume is increase slowly so that it is also a nice alarm clock in the morning

5 Likes

In addition in my app the color of the display is red redish between alarms and will change to bright blue slowly while alarming. Red is good night color and blue for wakeup and keeps you going. (also your eyes can see red objects only if you look straight to the object in a small angle of view so the red light don’t disturb you like other colors of whisch blue is the most disturbing because but blue color is visible for you eyes 180 degrees). and: my app will turn the radio to news channel every hour xx.00 for 6 minutes. I can share it but it is a bit difficult to understand because my clock has several hands to show: month, day of month, day of week (Monday, Tuesday…) and also 12 and 24 hour

5 Likes

Sounds very interesting, and I would really like to take a look at it, when you are ready to share.

3 Likes