I'm going to answer the first part of my own question.
After upgrading my iPod Touch to iOS 5, Location Services started working again. Not only did it start working, it's showing the location as a point in the street in front of the house.
1) The location I manually submitted to Skyhook in 2009 was in the street farther south, by the mailbox, so the old data point is not being used. Not suprised since I have no reason to believe that Apple went back to Skyhook. A visit to Skyhook's website verified that this point has not changed.
2) The location that Apple started using last year was a point on the main highway 1/2 mile east of here.
So somehow Apple has independently obtained new data about my wifi location. It's possible that during a recent party, somebody with an iPhone had connected to my Wifi and that data was sent back to Apple. It's also possible that a Wifi data collection vehicle drove down this road. It's very rural with only three homes on a one mile stretch, so although possible it's difficult to believe.
It was my previous understanding that Apple started requiring that devices be within range of several Wifi signals to improve Location Services accuracy. Being in a rural location, it's nearly impossible for my iPod to pick up any Wifi signal other than my own. With Skyhook, this was never an issue.
However, iOS 5 seems to heavily depend on Location Services so maybe they've changed something critical to how it functions in order to improve accuracy without requiring multiple Wifi signals.
I'm going to accept my own answer. If anyone has a better answer to my original question, I'll consider accepting that instead.
First of all, you need homebrew installed on your system. If you haven't, visit http://brew.sh for instructions, or let me know and I will try to guide you.
Then you need to install arp-scan
. To do it, open a Terminal and type brew install arp-scan
.
Next step. Save the following script, I called check-iphone-available.scpt
, but your can rename if you want.
set IPHONE to do shell script "if /usr/local/bin/arp-scan -l | grep your-iphone-mac; then echo 1; else echo 0; fi" user name "your-username" password "your-password" with administrator privileges
tell application "System Events"
tell process "Messages"
tell menu bar 1
tell menu bar item "Messages"
tell menu "Messages"
tell menu item "My Status"
tell menu "My Status"
if IPHONE is not equal to "0" then
click menu item "Available"
else
click menu item "Away"
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
Replace your-username
, your-password
and your-iphone-mac
.
your-username
must be an administrator user that can sudo on your computer.
your-password
password for that user.
your-iphone-mac
can be obtained on your iphone, go to Settings
-> General
-> About
and copy Wi-Fi Address
.
Give permissions: chmod 775 check-iphone-available.scpt
.
The script execute as administrator the command arp-scan
. This command sends ARP packets to hosts on the local network and displays any responses that are received. The grep
command look for your iphone on the answer receive by arp-scan
. If the iphone is found, then return 1, otherwise, return 0. On 1, the script do click on Available menu item in Messages, on 0, the same on Away (can be changed by Offline
, On the phone
, etc).
So, let's do it automatically.
Go to folder /Users/your-username/Library/LaunchAgents
and save there the following plist file. I named it com.username.checkiphone.plist
, but again, feel free to change it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.your-username.checkiphone</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/your-username/bin/check-iphone-available.scpt</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/com.your-username.checkiphone-available.err</string>
<key>StandardOutPath</key>
<string>/tmp/com.your-username.checkiphone-available.out</string>
</dict>
</plist>
The file is pretty self-explanatory. We will launch the command /usr/bin/osascript /Users/your-username/bin/check-iphone-available.scpt
every 60 seconds, will be launched at load, will save errors on /tmp/com.username.checkiphone-available.err
and logs on /tmp/com.username.checkiphone-available.out
.
Again, replace your-username
appropriately.
Last step, tell the Mac launchd daemon to load it.
launchctl load com.your-username.checkiphone.plist
To stop the script, just replace the word load
with unload
in the above sentence. When your restart your computer the script will be load again. To prevent it, move it to another folder.
Best Answer
This. Precisely this.
It also works if you connect the device to your car system over USB (not just charging, but actually connected to receive phone calls), or start CarPlay if supported by your car.