posted to this is not a weblog
on jan 3rd, 2008

tagged iphone, nerd, sqlite
and never commented on

share this page

someone finally made a utility for the iphone to constantly alert you when you have unread sms messages. usually the iphone just vibrates and alerts once when you get a message and if you miss those, you usually never notice the message until much later. the continuous nagging was something i missed from my treo.

however, i didn't like that it vibrates every 15 seconds and that it will vibrate right after you get a message even if you haven't really "missed" it. since it's just a shell script that calls "sleep 15", it isn't really smart about what a missed message is. so i modified it to wait 60 seconds between alerts and only alert when an unread message is older than 60 seconds, so you have time to actually see the new message before being nagged about it.

# cat /usr/local/smsnotify/smsnotify.sh
#!/bin/sh
smsnpath=/usr/local/smsnotify
sql=$smsnpath/sqlite3
vibrate=$smsnpath/vibrator

while test 1
do
 now=`/bin/date +%s`
 n=`$sql /var/root/Library/SMS/sms.db "select count(*) from message where flags=0 and date < ($now - 60)"`;

 if [ "$n" -gt 0 ]
 then
  $vibrate
 fi
 sleep 60
done

i tried to make it also nag on missed calls using the call history database (/var/root/Library/CallHistory/call_history.db) but there doesn't seem to be a field in there indicating whether the missed call has been "seen" like in the sms database. i'm not sure what the iphone uses to show the number of missed calls on the dock.

select * from call where duration = 0 and flags = 4

will pull all of the missed incoming calls but there's no way to see which have been acknowledged or not.

leave the first comment or contact me

if you want to be able to mark your comment as authentic or delete it later, include your e-mail address (it won't be shown on the site). you'll be e-mailed instructions with a copy of your comment.

basic html allowed; be nice
required


optional


optional