YouScan Company Overview - Social Media Listening with Visual Insights.pdf
Place InSights - Social Analytics App on Android
1. Project 4 Task 2 – Place InSights app on Android
By Rohan Nanda
Description:
My application makes use of 2 APIs. One is Google’s Places API, and the other is Trippin’IN API. My app
mashes up information from both these APIs to present social channel details of the closest matched
searchstring. The search could be for a place to eat, drink, party, shop or go outdoors in some city. I
present the number of checkins on facebook, facebook likes, rankings in top categories and subcategories, and an Instagram photo feed.
I use longitude and latitude coordinates from places API, along with other details, and use that as input
in trippin’IN’s API.
Note:
a. Only popular cities work in the input. Although Google places’ library is vast, Trippin’IN’s database of
places is limited. Pittsburgh is not in its database.
b. It is assumed that the user will enter good valid data as input. Fault tolerance is handled to a fair
extent.
c. Examples of searches are:
Restaurants: Penelope, California Pizza Kitchen in New York
Party places:Pacha London
d. There is a cap of 50 requests for Places API per 24 hours.
2. Implement a native Android application
The name of my native Android application project in Eclipse is:
PlaceInSightsAndroid
2.1My application uses TextView, EditText, Button, and ImageView. See main.xml for
details of how they are incorporated into the RelativeLayout.
Here is a screenshot of the layout before the picture has been fetched.
2. 1.2. Requires input from the user
Here is a screenshot of the user searching for the night club: Pacha London
1.3. Makes an HTTP request (using an appropriate HTTP method) to your web app
My application does the HTTP request in PlaceInsightsServlet.java. The HTTP request is:
"http://1.placeinsights12.appspot.com/Place_InSightsServlet?searchstring=penelope"+search
where search is the user's search term.
The search method makes this request of my web application, parses the returned
XML to get the details to show the user
1.4. Receives and parses an XML or JSON formatted reply from the web app
My good response is:
<response>
<title>Pacha London</title>
<icon/>
<open_now/>
<imageurl>
http://graph.facebook.com/180159821999925/picture?type=large
</imageurl>
<maincategory>Party</maincategory>
4. 1.5. Displays new information to the user
Find below a screen shot of the output:
1.6. Is repeatable (I.e. the user can repeatedly reuse the application without
restarting it.)
5. 2. Implement a web application, deployed to Google App Engine
The name of the Google App Engine project in Eclipse is:
PlaceInSights
2.1. Uses the MVC design pattern
In my web app project:
Model: PlaceInSightsModel.java
View: prompt.jsp
Controller: PlaceInSightsServlet.java
2.2. Receives an HTTP request from the native Android application
PlaceInSightsServlet.java receives the HTTP request with
the argument "search". It passes this search string on to the model.
2.3. Executes business logic appropriate to your application
PlaceInSightsModel.java does an HTTP request to:
2 APIs,
Trippin’ Ins API:
http://api.v1.trippinin.com/match/[place name]?coordinates=[lat,lng]&KEY=[your API key]
and Google’s places API.It then parses the XML response from Google api, puts the coordinates and
closest relevant search result in the input of TRIPPIN’IN’s API, and extracts the parts it needs to respond
to the Android application. I parse JSON from Trippin’in.
6. 2.4. Replies to the Android application with an XML or JSON formatted response.
I format the response using in-built argument setting while outputting. I set the content type in the
servlet PlacesInSightsModelto “text/xml”.