View Single Post
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1029
Originally Posted by slarti View Post
The basic idea is to set a special profilematic 'alarm rule' which executes its actions when an alarm with a certain title goes off. The rule gets deactivated when the next active alarm is not one with the set title or there are no alarms. The alarm title is set in the script as the passwd variable. By default, it's Test.
Very nice.

A couple of questions:
- Is this basically implementing the functionality you've requested about alarms?
- I see you require only one rule, but since ProfileMatic's interface only provides getting all rules, you need to iterate through them. Would a getRule(ruleId) be something that'd be useful for this?

Now, how to make it run as a daemon on startup?
Easiest way is to put it into ProfileMatic's Default rule's custom action. That way it gets started during every reboot of the phone (after the customary 2-4 minutes beyond homescreen becoming visible).

A more robust way, which will have the benefit of restarting the service if it crashes, is to use Upstart. Simply create a configuration file into /etc/init/apps. You can see profilematicd.conf for example, or anything else that is there. More comprehensive help is in harmattan dev docs and of course in Upstart's docs.
__________________
My N9/N950 projects:
 

The Following User Says Thank You to ajalkane For This Useful Post: