Attached is an application that provides reminders when an unread SMS message / email or unanswered phone call occurs on the iPhone. Configurable options are status bar icons, periodic vibration events or audio playback of a ring tone. For vibration and ring tone playback the user can select the interval and number of cycles.
This code is early beta quality at this juncture and has been tested on 1.1.3 and 1.1.4.
Notable is that for vibration and ringtone playback the iPhone is setup to prevent sleep until user selected cycles are completed. Only then is the iPhone permitted to return to sleep. (Note that this was a problem with Nate True's scheme based upon a shell script.)
As background the concept behind the architecture of this software is the use of launchd to start the daemon when a database file changes (e.g. SMS, email or phone call). The daemon provides event specific reminders based upon configuration via command line switches. At this juncture the configuration is based upon the contents of the launchd plists.
Attached is a zip file with the daemon and two directories. The first directory contains the status bar icons which must be copied, as shown below, into the Springboard directory. The second directory contains plists for launchd which serve to launch the daemon when a database file changes.
Once the zip file is unpacked the files need to be copied as follows,
Quote:
Reminder -> /sbin
Default_CALLT.png -> /System/Library/CoreServices/SpringBoard.app
Default_EMAILT.png -> /System/Library/CoreServices/SpringBoard.app
Default_SMST.png -> /System/Library/CoreServices/SpringBoard.app
FSO_CALLT.png -> /System/Library/CoreServices/SpringBoard.app
FSO_EMAILT.png -> /System/Library/CoreServices/SpringBoard.app
FSO_SMST.png -> /System/Library/CoreServices/SpringBoard.app
com.mailReminder.plist -> /Library/LaunchDaemons
com.phoneReminder.plist -> /Library/LaunchDaemons
com.smsReminder.plist -> /Library/LaunchDaemons
|
Springboard must be restarted for the status bar icons to be noticed. Restart the iPhone, or use "SysInfo" to "respring" Springboard.
Next using UICTL, or launchctl, the daemon must be enabled for each reminder class (mail, phone and sms). If you use launchctl on the iPhone then the following should be executed in the LaunchDaemons directory,
Quote:
cd /Library/LaunchDaemons
launchctl load -w com.mailReminder.plist
launchctl load -w com.phoneReminder.plist
launchctl load -w com.smsReminder.plist
|
To disable reminder either use UICTL or launchctl as follows,
Quote:
cd //Library/LaunchDaemons
launchctl unload -w com.mailReminder.plist
launchctl unload -w com.phoneReminder.plist
launchctl unload -w com.smsReminder.plist
|
Command line arguments to the reminder daemon are,
Code:
Usage: Reminder [OPTION]
-i xx Interval in seconds between events
-c xx Number of events
-v Vibrate at event time
-r xx Play ringtone name at event time
-s SMS Reminder
-p Unanswered phone call reminder
-m Unread mail reminder
-d Delete icons from status bar
An example launchctl plist is the SMS plist shown below. Two arguments are provided to the reminder daemon, "-s" and "-r". The "-s" tells the daemon that a SMS event occurred and "-r" followed by a ringtone name indicates that the ringtone should be played periodically.
HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.smsReminder</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/sbin/Reminder</string>
<string>-s</string>
<string>-r</string>
<string>Harp</string>
</array>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>UserName</key>
<string>mobile</string>
<key>WatchPaths</key>
<array>
<string>/var/mobile/Library/SMS/sms.db</string>
</array>
</dict>
</plist>
Limitations / Issues / Other Notes:
1) Ringtones must reside in /Library/Ringtones. This could change if people want to supply a full path to the file.
2) The email database can be locked by the iPhone for extended periods of time, thus preventing the daemon from accessing the database file. The daemon retries a number of times to access the database, but if it never gets access the reminder does not occur.
3) The default reminder interval is 15 seconds and the count is 4. Use "-i" and "-c" to specify an alternative interval and/or count.
4) The code is event based. As such it only uses power when a sms, phone call, email event occurs.
5) The "-d" command line switch is for debug and wouldn't be used in the launchd plist.
6) The code only supports iPhone version 1.1.3 or later.
7) Each of the sample plists in the AudioReminder subdirectory has an arbitrary ringtone specified. Edit the plist, unload and reload the daemon (or reboot the iPhone) for the change to take effect.
8) No code from "taskbar notifier" was employed in this effort. This effort was based upon limitations found in Nate True's shell script approach.
Deinstall:
To deinstall reminder unload each reminder class as shown above using UICTL or launchctl with the unload -w arguments. Once the daemon has be unloaded, delete the files from the install locations.
Acknowledgments:
Erica Sadun - Provided help on the status bar icon code.
stuart.william.taylor - Status bar icons.