Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Find Friend Location Java Example-latitude.  RSS feed

 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

Does anyone have any simple java source examples on how to find a "GPS" friend, determine if they are sharing their location via Google Latitude API and then get their location.
(this post may not suit for here but i post this here because i couldn't find any place to ask this and sorry for that).

thanks.
sampath premarathna.
 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally got a solution. first of all you have to get the user id for the user that you going to get location from https://www.google.com/latitude/apps -> Enable and show best available/Enable and show city-level only . then you can get JSON or ATOM format user details from latitude and then you can get the location and ... using that.
call--
LatitudeJSONParser.getPosition("http://www.google.com/latitude/apps/badge/api?user=" + userid+ "&type=json");

you can find LatitudeJSONParser.java and other required java files from here.
http://code.google.com/p/whereisschtief/source/browse/trunk/?r=17#trunk/WhereIsSchtief/src/org/schtief/whereisschtief
 
Chris Grant
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sampath:

Thanks for doing this. I have been looking for this for a while and someone finally posted something on this. I followed your example. I have a gmail acct and an Android phone. I shared myself public and added this line of code in my app (note that MYUSERCODE has my real # from the latitide site):


Location l = LatitudeJSONParser.getPosition("https://www.google.com/latitude/apps/badge/api?user=MYUSERCODE&type=json");

I am getting back a location that seems to be in my neighborhood, but it does not update. The time stamp, lat and long stay the same and i drove around for a good mile. Any thoughts? I am updating the printout every second.

Chris
 
sampath premarathna
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry i cant give you a clear answer.But i think it may because of your internet connection.Google may get your location from that location and it is never change.something like that.
 
Mostafa Mamdouh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all,i need your help please, i downloaded the whole package ,when i try to use your command line,it gives me error it the object must start with "{",then i read in the class that object must start and end with "{" ,it gives me wrong exception and prints out saved data such as {"content":"This is a collection of test patterns and examples for org.json."}
{"list of lists": [,i really need your help.
Best Regards
 
Mostafa Mamdouh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i fixed it ,dummy mistakes, for chris i think i got an answer for you,see it updates only based check in,but location history which google latitude record it every second isn't available for public
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!