webOS Nation Forums >  webOS apps and software >  webOS development > Update to GPS tracking mod- can someone update the wiki?
Update to GPS tracking mod- can someone update the wiki?

  Reply
 
LinkBack Thread Tools Display Modes
Old 06/27/2009, 06:31 PM   #1 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default Update to GPS tracking mod- can someone update the wiki?

Wiki & original script is here: pre dev wiki: GPS Tracking

What that does is set up a job to run every 5 minutes, and check to see if you've gotten a text message that contains your secret code word.

If you have, it emails you the current GPS location of your phone-- you know, that service that Apple wants you to pay for?

Anway, I've updated the script so that instead of sending raw data, it will instead send a URL to Google Maps, and I added more comments, so if anyone wants to try to take this further, it's hopefully less work.

Ze code:
Code:
SECRET=make up any secret code here-- must be a single word
DEST=put your e-mail address here

track()
{
        # Call the GPS radio to get the location
        # The more times you run this (-n #), the more accurate it will get. Going above 3 does not seem to make any real difference
        # The tail -l command ensures that if you do run this multiple times, we only look at the last output.
        pos=$(luna-send -n 3 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1)

				#strip the resulting information down to just the numeric values and the commas
				pos=$(echo $pos | sed -r 's/[^-\.0-9,]//g')

        #echo $pos

        #We only care about 5 fields-- lat, lon, speed, altitude, and heading.
        #Use the cut function to split $pos and get those values

        lat=$(echo $pos | cut -d, -f4)
        lon=$(echo $pos | cut -d, -f5)
        hed=$(echo $pos | cut -d, -f7)
        spd=$(echo $pos | cut -d, -f8)
        alt=$(echo $pos | cut -d, -f9)

        #Create the URL to google maps
        msg=$(echo "http://maps.google.com/?ie=UTF8&q=$lat,$lon+(Heading:%20$hed%0DSpeed:%20$spd%20mph%0DAltitude:%20$alt)")
        #echo $msg

        #send the message
        luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"value": "'${DEST}'", "contactDisplay": "'${DEST}'", "prefix": "to$A", "identifier": "palm_anon_element_8"}], "messageText": "'"$msg"'"}'
}

checkmsg()
{
        #Check to see if there have been any text messages sent in the last 5 minutes containing our secret string
        echo ".timeout 30000" > /tmp/trackersql
        cmd='SELECT messageText FROM com_palm_pim_FolderEntry WHERE timeStamp > (strftime("%s000", "now")-600000);'
        #output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3)
        output=$(echo $cmd|sqlite3 -init /tmp/trackersql /var/luna/data/dbdata/PalmDatabase.db3)
        echo $output|grep $SECRET 2> /dev/null > /dev/null
        status=$?

        if [ $status = 0 ]; then
                track
        fi
}
checkmsg
Enjoy!
jsabo is offline   Reply With Quote
Old 06/27/2009, 07:13 PM   #2 (permalink)
Member
 
backlund's Avatar
 
Join Date: Jan 2007
Posts: 120
Likes Received: 0
Thanks: 5
Thanked 12 Times in 7 Posts
Default

I assume a rooted pre is necessary?
backlund is offline   Reply With Quote
Old 06/28/2009, 01:05 AM   #3 (permalink)
Member
 
Join Date: Jun 2009
Posts: 127
Likes Received: 0
Thanks: 52
Thanked 10 Times in 9 Posts
Default

awesome idea thank you
Shane112358 is offline   Reply With Quote
Old 06/28/2009, 01:44 AM   #4 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

Quote:
Originally Posted by backlund View Post
I assume a rooted pre is necessary?
Totally. This is just a background job in linux that happens to call a couple of the Pre-specific functions.

I might make a couple more passes at it to clean up the DB query and automatically send the location to anyone who knows the password-- that way, when you lose your phone, you can use your buddy's phone to find it.
jsabo is offline   Reply With Quote
Old 06/28/2009, 08:46 AM   #5 (permalink)
Member
 
Join Date: Jun 2009
Posts: 204
Likes Received: 18
Thanks: 5
Thanked 18 Times in 14 Posts
Default

Wouldn't it be easier (and better on the battery) to just hack the messaging app to look for specific keywords and either sms the location back to the user or call a separate app to email the google maps url for the location?
mattbrad2 is offline   Reply With Quote
Old 06/28/2009, 11:42 AM   #6 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

Quote:
Originally Posted by mattbrad2 View Post
Wouldn't it be easier (and better on the battery) to just hack the messaging app to look for specific keywords and either sms the location back to the user or call a separate app to email the google maps url for the location?
Rather than running the cron job every 5 minutes? Better on battery, possibly. Easier is debatable.

Hacking the app would probably mean adding just a single line for the check, which is probably better for the battery. But you would need to find where that is in the app, and if they update the app, your hack goes away.

Either way, I just modified what the original poster did, rather than trying to reinvent the wheel.

That said, right now, you do see the incoming message with the code word, and you do see the outgoing message with the URL in it-- if I stole your phone, it's semi-obvious that the phone just reported its location to someone.

Another poster showed a hack that would report the phone's location back to a web server, rather than replying with a text. It did that every time the script ran.

Another possible change would be to combine the two-- if I send the code word to the phone, via text, have it automatically start reporting its location to a web server, rather than replying back via text. Going in that direction could get more interesting, as you could set up MobileMe like functionality for the masses.

Maybe something to do next week
jsabo is offline   Reply With Quote
Old 07/28/2009, 01:26 AM   #7 (permalink)
Forum Leader
 
mamouton's Avatar
 
Join Date: Jan 2007
Location: Fort Worth, TX
Posts: 5,771
Likes Received: 5
Thanks: 796
Thanked 1,165 Times in 801 Posts
Default

Quote:
Originally Posted by jsabo View Post
Wiki & original script is here: pre dev wiki: GPS Tracking

What that does is set up a job to run every 5 minutes, and check to see if you've gotten a text message that contains your secret code word.

If you have, it emails you the current GPS location of your phone-- you know, that service that Apple wants you to pay for?

Anway, I've updated the script so that instead of sending raw data, it will instead send a URL to Google Maps, and I added more comments, so if anyone wants to try to take this further, it's hopefully less work.

Ze code:
Code:
SECRET=make up any secret code here-- must be a single word
DEST=put your e-mail address here

track()
{
        # Call the GPS radio to get the location
        # The more times you run this (-n #), the more accurate it will get. Going above 3 does not seem to make any real difference
        # The tail -l command ensures that if you do run this multiple times, we only look at the last output.
        pos=$(luna-send -n 3 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1)

				#strip the resulting information down to just the numeric values and the commas
				pos=$(echo $pos | sed -r 's/[^-\.0-9,]//g')

        #echo $pos

        #We only care about 5 fields-- lat, lon, speed, altitude, and heading.
        #Use the cut function to split $pos and get those values

        lat=$(echo $pos | cut -d, -f4)
        lon=$(echo $pos | cut -d, -f5)
        hed=$(echo $pos | cut -d, -f7)
        spd=$(echo $pos | cut -d, -f8)
        alt=$(echo $pos | cut -d, -f9)

        #Create the URL to google maps
        msg=$(echo "http://maps.google.com/?ie=UTF8&q=$lat,$lon+(Heading:%20$hed%0DSpeed:%20$spd%20mph%0DAltitude:%20$alt)")
        #echo $msg

        #send the message
        luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"value": "'${DEST}'", "contactDisplay": "'${DEST}'", "prefix": "to$A", "identifier": "palm_anon_element_8"}], "messageText": "'"$msg"'"}'
}

checkmsg()
{
        #Check to see if there have been any text messages sent in the last 5 minutes containing our secret string
        echo ".timeout 30000" > /tmp/trackersql
        cmd='SELECT messageText FROM com_palm_pim_FolderEntry WHERE timeStamp > (strftime("%s000", "now")-600000);'
        #output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3)
        output=$(echo $cmd|sqlite3 -init /tmp/trackersql /var/luna/data/dbdata/PalmDatabase.db3)
        echo $output|grep $SECRET 2> /dev/null > /dev/null
        status=$?

        if [ $status = 0 ]; then
                track
        fi
}
checkmsg
Enjoy!
==I have a question about the GPS tracker? SECRET=make up any secret code here DEST=put your e-mail address here. When I setup Cron to test it at a minute I received the email. When I sent the secret code I never received anything, am I missing something? Do I need to set the email up as mailto:xxxx#@domain.com?
mamouton is offline   Reply With Quote
Old 07/28/2009, 05:48 PM   #8 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

I just had myname@mydomain.com for the mailto.

Did you see the chat message come in? It should have showed up like any other chat.

Another thought-- don't include spaces in your secret word.

I've had issues myself getting it to work properly, not really clear why it sometimes works and sometimes fails. One thing I have seen is that you can't use the command line to send a text message unless you're running as root.
jsabo is offline   Reply With Quote
Old 07/29/2009, 07:12 PM   #9 (permalink)
Forum Leader
 
mamouton's Avatar
 
Join Date: Jan 2007
Location: Fort Worth, TX
Posts: 5,771
Likes Received: 5
Thanks: 796
Thanked 1,165 Times in 801 Posts
Default

SECRET=make up any secret code here
DEST=put your e-mail address here

DEST=mailto: user@domain.com

DEST=user@domain.com

Which one worked for you

What are your crond settings?

Last edited by mamouton; 07/29/2009 at 07:19 PM.
mamouton is offline   Reply With Quote
Old 08/04/2009, 01:15 PM   #10 (permalink)
Member
 
Paladin's Avatar
 
Join Date: Nov 1999
Location: City of Champions!!!
Posts: 617
Likes Received: 0
Thanks: 5
Thanked 54 Times in 36 Posts
Default

I would like to add this to my Pre. Is this still the best app/script we have for tracking our Pre?

Also how do you stop the emails? I would like to remotely be able to turn it on and off.

Also if it is stolen, is there a way for them to turn the GPS off, besides turning the phone off of course? If it was off will this turn it on?

Has anyone that did this notice extra battery drain, or more important, any Pre sluggishness?
__________________
Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
Pittsburgh Steelers-6 Time Super Bowl Champions!

Pittsburgh Penguins-3 Time Stanley Cup Champions!

Last edited by Paladin; 08/04/2009 at 01:23 PM.
Paladin is offline   Reply With Quote
Old 08/05/2009, 01:52 AM   #11 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

Quote:
Originally Posted by mamouton View Post
SECRET=make up any secret code here
DEST=put your e-mail address here

DEST=mailto: user@domain.com

DEST=user@domain.com

Which one worked for you

What are your crond settings?
DEST=user@domain.com worked for me. crond settings were straight off the wiki.
jsabo is offline   Reply With Quote
Old 08/05/2009, 01:57 AM   #12 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

Quote:
Originally Posted by 1Paladin View Post
I would like to add this to my Pre. Is this still the best app/script we have for tracking our Pre?

Also how do you stop the emails? I would like to remotely be able to turn it on and off.

Also if it is stolen, is there a way for them to turn the GPS off, besides turning the phone off of course? If it was off will this turn it on?

Has anyone that did this notice extra battery drain, or more important, any Pre sluggishness?
As it stands, you send the text, and the next time the cron job runs, it texts you back the location. It's all a one-time thing.

I'm in the process of building a website that will allow for more MobileMe like tracking of the phone, and which will also be invisible to the phone, should you be trying to find a location of a stolen phone-- no more spontaneous outgoing texts containing the current location of the phone to tip off a thief that they're getting tracked.

Hopefully will have some progress on that by the end of the weekend.
jsabo is offline   Reply With Quote
Thanked by ryran, sracercelica
Old 08/05/2009, 02:32 AM   #13 (permalink)
Member
 
Join Date: May 2009
Posts: 353
Likes Received: 0
Thanks: 7
Thanked 57 Times in 41 Posts
Default

Quote:
Originally Posted by jsabo View Post
As it stands, you send the text, and the next time the cron job runs, it texts you back the location. It's all a one-time thing.

I'm in the process of building a website that will allow for more MobileMe like tracking of the phone, and which will also be invisible to the phone, should you be trying to find a location of a stolen phone-- no more spontaneous outgoing texts containing the current location of the phone to tip off a thief that they're getting tracked.

Hopefully will have some progress on that by the end of the weekend.
Sounds great.

I would love to see something, like you mention, that'll be invisible to a thief.

Also, any recommendations on how to make it a recurring thing? I see it's basically a one-shot deal, but is there a was to edit your script such that the phone will kepp sending the e-mail anytime the cron job runs, as long as your secret password still exists in a previous text message? It's easy to pick a word that's random enough that it'll only be in a text message if you send it there on purpose, so maybe it wouldn't just check in a certain time period, but instead check every message, and then phone home if the word is anywhere in a text message?

It's also pretty late, which may explain why I'm having trouble getting everything set up just right and tested, and why I'm not "getting it" right now, but thanks for your work on this stuff.
pullbangdead is offline   Reply With Quote
Old 08/07/2009, 10:25 AM   #14 (permalink)
Member
 
Paladin's Avatar
 
Join Date: Nov 1999
Location: City of Champions!!!
Posts: 617
Likes Received: 0
Thanks: 5
Thanked 54 Times in 36 Posts
Default

I will wait for a new version/info before I install anything then. ii
Thanks for this.
__________________
Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
Pittsburgh Steelers-6 Time Super Bowl Champions!

Pittsburgh Penguins-3 Time Stanley Cup Champions!
Paladin is offline   Reply With Quote
Old 08/07/2009, 02:18 PM   #15 (permalink)
webOS Enthusiast
 
Abyssul's Avatar
 
Join Date: Jul 2009
Posts: 2,132
Likes Received: 45
Thanks: 41
Thanked 807 Times in 433 Posts
Default

I am definitely looking forward to this. I'm sure, somewhere along the lines, I will lose or get my phone stolen and want to be able to narrow it down specifically. I think this project should be expanded upon quickly.
Abyssul is offline   Reply With Quote
Old 08/09/2009, 05:41 PM   #16 (permalink)
Member
 
Paladin's Avatar
 
Join Date: Nov 1999
Location: City of Champions!!!
Posts: 617
Likes Received: 0
Thanks: 5
Thanked 54 Times in 36 Posts
Default

So how is this coming along? No hurry, just doing a bump! ii
__________________
Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
Pittsburgh Steelers-6 Time Super Bowl Champions!

Pittsburgh Penguins-3 Time Stanley Cup Champions!
Paladin is offline   Reply With Quote
Old 08/09/2009, 06:56 PM   #17 (permalink)
Member
 
Join Date: Aug 2009
Posts: 292
Likes Received: 0
Thanks: 2
Thanked 38 Times in 15 Posts
Default

The version that I have shouldn't show up any information to the person. I will have to check it a little more to verify it. I can see a run on Dyndns domains now
Ikyo is offline   Reply With Quote
Old 08/11/2009, 02:17 PM   #18 (permalink)
Member
 
caferacer's Avatar
 
Join Date: Jul 2009
Posts: 105
Likes Received: 0
Thanks: 21
Thanked 9 Times in 6 Posts
Default

Hold on.... so it shows the incoming and outgoing text?

Why not just find the command/whatever needed to delete the text?

this reminds me of the program called nueGPS for winmo.... he came up with a silent way to mail back GPS coordinates and a google maps URL.

For those interested in continuing this development, you might want to talk to this guy.

nueGPS Critical update
caferacer is offline   Reply With Quote
Old 08/11/2009, 02:19 PM   #19 (permalink)
Member
 
Join Date: Aug 2009
Posts: 292
Likes Received: 0
Thanks: 2
Thanked 38 Times in 15 Posts
Default

It only shows an incoming message. It doesn't show anything else.
Ikyo is offline   Reply With Quote
Old 08/15/2009, 02:52 AM   #20 (permalink)
Member
 
mrloserpunk's Avatar
 
Join Date: Jul 2008
Location: Syracuse
Posts: 2,564
Likes Received: 0
Thanks: 740
Thanked 442 Times in 327 Posts
Default

im having trouble getting this to work. I have the script in the right place, but i lose it here

sudo -i
mount -o remount,rw /
ipkg-opt update
ipkg-opt install cron
/opt/bin/crontab -e
# Add script and intervals here
mount -o remount,ro /

what do i put in there and do i need to do sudo -i initctl start crond
__________________
"When there is no more room in hell, the dead will walk the earth"


PM me your questions, If I cant find an answer, I'll show you who can.
mrloserpunk is offline   Reply With Quote
Reply

 

Tags
gps, tracking

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0