Information Technology Reference
In-Depth Information
user's restaurant is booked out, and instead suggest a dinner cruise
on the Hudson. You save them a disappointing trip, and give them a
great experience instead.
So now we have the big picture about what we want to build, and why a user would
want to use such an application. Let's get started!
Introducing the "Move Me" Example Application
Our sample application is called "Move Me." We'll use it to explore how we can find
nearby transport options from any location. Of course, we'll detect our location using the
techniques we covered in chapter 9. Namely, we'll use the geolocation capabilities of
our Android device to determine our latitude and longitude, and then use those data to
drive a search service to find our preferred mode of transport.
Examining the Code
Listing 10-1 shows the code for the first version of Move Me. Don't be daunted by its
length: we'll break this down and cover the various components to give you an
understanding of its workings, and inspiration to take this example further and expand it
to your own ideas.
Listing 10-1. The Move Me application source code, version 1
<!--
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-
2.0
-->
<html>
<head>
<title>Move Me! - Transit Search Example
</title>
<link href="./ch10-example01.css" rel="stylesheet" type="text/css"/>
<script
src=" http://www.google.com/jsapi?key=AIzaSyBU-TWQkYc-
ynkeYIrd_ aP0UFdyRieCyR0"
type="text/javascript">
</script>
<script type="text/javascript">
google.load('maps' , '3', {"other_params":"sensor=false"});
google.load('search', '1');
var myLatLong;
var myTransitMap;
var myLocalSearch;
var searchResults = [];
var resultMarker = new google.maps.MarkerImage(
"Red_Train_Marker.png",
new google.maps.Size(20, 34),
new google.maps.Point(0, 0),
new google.maps.Point(10, 34));
 
 
Search WWH ::




Custom Search