首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java相关 >

java 获取Google Maps Data API 服务,该如何解决

2013-07-04 
java 获取Google Maps Data API 服务import com.google.gdata.client.*import com.google.gdata.client.m

java 获取Google Maps Data API 服务
import com.google.gdata.client.*;
import com.google.gdata.client.maps.*;
import com.google.gdata.data.*;
import com.google.gdata.data.maps.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.net.URL;

public class GetMapsFeel
{
public static void main(String[] args){
MapsService myService = new MapsService("applicationName");
try{
myService.setUserCredentials("username","password");
}catch(AuthenticationException e){
e.printStackTrace();
}
try{
printUserMaps(myService);
}catch(ServiceException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
}
public static void printUserMaps(MapsService myService) throws ServiceException,IOException {
final URL feedUrl=new URL("http://maps.google.com/maps/feeds/maps/default/full");
MapFeed resultFeed = myService.getFeed(feedUrl,MapFeed.class);
System.out.println(resultFeed.getTitle().getPlainText());
for(int i=0;i<resultFeed.getEntries().size();i++){
MapEntry entry=resultFeed.getEntries().get(i);
System.out.println(entry.getTitle().getPlainText());
System.out.println("Summary"+entry.getSummary().getPlainText());
System.out.println("Self Link:"+entry.getSelfLink().getHref()+"\n");
}

}
}
运行时报com.google.gdata.util.AuthenticationException: Error connecting with login URI,是applicationName,username和password的原因,这个我不会写, Java google map 地图
[解决办法]
该回复于2013-06-12 14:52:04被管理员删除

热点排行