3

I am currently developing a reminder application for SailfishOS. There's one thing I haven't been able to figure out yet:

Is there a possibility to register with the OS for a specific date (and maybe an ID), so that my app will be invoked to do its reminder thing? This should also be working when my app has been stopped or the phone has been rebooted, so I assume that a QML Timer will probably not be an option.

Ideally I am looking for a QML/JavaScript solution (if possible), because my C++ skills are non-existent. I have also been browsing repository of some open source projects, but haven't found a solution yet.

Links to relevant source repositories are also very appreciated...

László Papp
  • 51,870
  • 39
  • 111
  • 135
peterp
  • 3,101
  • 3
  • 22
  • 37
  • 1
    That is highly OS dependent, in fact it is more about SailfishOS than about Qt. Scheduling a program to execute probably has nothing to do with the framework you used to build the application. – sashoalm Mar 15 '14 at 14:49
  • @sashoalm: unless you have a daemon written in Qt that invokes the application. – László Papp Mar 15 '14 at 15:48
  • @sashoalm Hmmm, good point; I have added the SailfishOS keyword to the question - the framework could still offer an API for OS functionality, though... – peterp Mar 15 '14 at 17:06
  • @peterp: why would it provide more than time and date, signals and slots, etc? If you want to write a daemon in C++ Qt, you can do that, if not, just use a cron job like alternative whatever it is on Sailfish OS. – László Papp Mar 15 '14 at 17:17
  • @LaszloPapp I can't even read C++ ;-) and I am just getting started with Qt as well as SailfishOS, so I hoped the framework could be of help with this – peterp Mar 15 '14 at 17:39

1 Answers1

2

Since you do not seem to have any C++ experience, I recommend not to write any Qt daemon for this task launched by systemd.

I suggest to follow this thread to invoke your application at the date and time desired:

How to add automated tweets via a cron job to WordPress

It is writing about tweets, but I would imagine the concept to be similar. After all, as far as I am aware Jolla intends to remain as much vanilla as possible based on the Mer stack.

Unfortunately, Sailfish OS is currently using an outdated systemd, so you cannot yet use systemd-cron since that requires at least sytemd 197. Although, as far as I know they are working on an update. That will bring the nicer future for your use case.

As indicated in the comments, if you do not have C++ experience, this is probably the easiest route. There will be no direct QML bindings for QProcess, etc, as you would need it.

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • Thanks for the link - I hope there's no Wordpress on my phone ;-) Yes, maybe I should really resort to a cron job, even though I hoped that I wouldn't need to go so deep into the system myself. In the meantime while researching I have found [this project](https://github.com/tanghus/kitchen-timer-qml/tree/ab5e628eb964ede97c1dfde15c86441db13e7d8b/src/insomniac) using a library called libiphb to achieve what I am after (at least I think so). Still need to have a deeper look into to make it run with my project. I'll keep you updated about the result and which path I went in the end :) Thanks again – peterp Mar 15 '14 at 19:09
  • @peterp: I do not think that is what you are looking for. It is just a kitchen timer and not cron job timer. It is also partially written in C++. You are trying to operate on system tasks, so it is quite natural that you go down to the system level, especially on a brand new platform. – László Papp Mar 15 '14 at 19:20
  • Hmm, you are probably right.... the more I think about it. I had read somewhere that this approach is suitable for longer intervals... but the kitchen timer probably thinks in maximum intervals of hours, not weeks. Thanks for your valuable input – peterp Mar 15 '14 at 19:41
  • Sorry for the late response, I've been on the road for the last 2 weeks. Well, Sailfish 1.0.4.20 obviously didn't bring systemd-cron, and I still haven't found out how to work around this. Of course, I'll keep this updated when I get wiser... hopefully soon :) – peterp Mar 30 '14 at 20:42
  • I have read that [systemd will be updated](https://together.jolla.com/question/16434/cronjob-on-sailfish/?answer=43375#post-id-43375) with the next update of SailfishOS for Jolla, so systemd-cron will be the way to go. There's also a workaround described in this answer (which I haven't tried, though, as my plans has decreased in priority after being on hold) – peterp Jun 06 '14 at 12:32