All info can be found here: GPS Tracking @ Pre Dev Wiki
This little modification will allow you to track your Palm Pre if it ever gets lost or stolen. Just ask this guy what he thinks about GPS tracking on his iPhone.
After implementing this GPS tracking method, your Pre will email you updates with GPS coordinates based on a predefined schedule. The email you receive will contain the Pre’s battery information as well as a Google Maps link of where the GPS coordinates are pointing to.
To start, you’ll need to have a rooted Pre with SSH access.
Instructions:
- Mount the file system with read-write access.
mount -o remount,rw /
- Make a directory for the GPS tracking script we’re about to make.
mkdir /home/scripts
- Add the code below to the beginning of the /etc/event.d/crond to enable the cron daemon at startup.
start on stopped configure stop on runlevel [!2] description "crond"
- Create a crontab entry and schedule the tracking script to run. NOTE: I’m using nano as the text editor. If you do not have nano, you can install it using the Optware package feed, or just use vi as the editor.
mkdir -p /etc/cron/crontabs nano /etc/cron/crontabs/root
Add the following to /etc/cron/crontabs/root:
*/5 * * * * /home/scripts/track.sh
The */5 means the script will run every time the number of minutes is divisible by 5. E.g. at 5, 10, 15 minutes, etc. Increase the denominator for less frequent updates.
- Finally, create the track.sh script in the /home/scripts directory created in step 2.
nano /home/scripts/track.sh
Copy/paste the code below, but be sure to edit line 2 to include your email address
#!/bin/sh DEST=YOUR_USERID@DOMAIN.com pos=$(luna-send -n 2 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1 | cut -d, -f4,5,8 | sed -r 's/[^-\.0-9,]//g') lat=$(echo $pos | cut -d, -f1) lon=$(echo $pos | cut -d, -f2) spd=$(echo $pos | cut -d, -f3) bat=$(grep BATTERY: /var/log/messages | tail -1 | awk '{print $8}' | sed 's/%,//') now=$(date) # Enable this below if you want to keep logs - not sure where to write them /var/home/root not the best place. # echo $now,$lat,$lon,$spd,$bat >>mygpsdata.log #Build a message variable for all the data to be logged. msg=$(echo $now,$lat,$lon,$spd,$bat ) #Build message content to be sent msg2=$(echo $now Speed:$spd Battery Level:$bat URL http://maps.google.com/maps?q=$lat%2C$lon) ret1=$(luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"value": "'${DEST}'", "contactDisplay": "'${DEST}'", "prefix": "to$A", "identifier": "palm_anon_element_8"}], "messageText": "'"$msg2"'"}' 2>&1) exit - Reboot your phone to start the cron daemon and you’re finished. You should now see emails coming into your inbox with the GPS coordinates of your Pre. I just archive the emails in Gmail to keep my inbox from becoming cluttered.
Here’s the tracking in action:
{ 2 comments }















