Tuesday, 3 May 2011

Send your GPS fix (geolocation) via SMS

Next, I will attempt to send a SMS of the current GPS fix to another phone using Google Map API V2. Unfortunately, this API is already deprecated by Google which I will need to find another way to future proof my app.


Codes:
gps_latitude = inResponse.latitude;
gps_longitude = inResponse.longitude;
this.controller.get('txtLatitude').mojo.setValue (gps_latitude);
this.controller.get('txtLongitude').mojo.setValue (gps_longitude);
google_map_url = "http://maps.google.com/?q=" + gps_latitude + "," + gps_longitude;
message_text = "Last known GPS fix - " + google_map_url;

this.controller.serviceRequest('palm://com.palm.applicationManager', {
method: 'launch',
parameters: {
id: 'com.palm.app.messaging',
params: {
composeRecipients: [
/*{
address: "the_email_address_you_want_to_send_to",
serviceName: "gmail"
},*/
{
address: mobile_no
}
],
messageText: message_text
}
},
onSuccess: {},
onFailure: {}
});

No comments:

Post a Comment