V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
liuxu
V2EX  ›  程序员

andorid 开发使用百度车联网天气 API 返回 No Result available,请问是啥情况?

  •  
  •   liuxu · 2015-02-25 16:20:12 +08:00 · 3538 次点击
    这是一个创建于 3411 天前的主题,其中的信息可能已经有所发展或是发生改变。
    String address="http://api.map.baidu.com/telematics/v3/weather?location=北京&output=json&ak=xxxxxxxx";
    //key我申请的是服务端api,白名单ip是0.0.0.0/0

    URL url=new URL(address);
    connection=(HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.setRequestProperty("contentType","utf-8");
    connection.setDoOutput(true);
    InputStream in=connection.getInputStream();
    BufferedReader reader=new BufferedReader(new InputStreamReader(in,"utf-8"));
    StringBuilder response=new StringBuilder();
    String line;
    while((line=reader.readLine())!=null){
    response.append(line);
    }

    response里面的是error:-3;result:No result available;

    看不出哪里有问题啊。。
    2 条回复    2015-02-26 09:46:14 +08:00
    welsmann
        1
    welsmann  
       2015-02-25 19:41:16 +08:00   ❤️ 1
    这个接口经常任性的,返回的数据格式有时候会不一致。
    很显然它又任性了一把。
    liuxu
        2
    liuxu  
    OP
       2015-02-26 09:46:14 +08:00
    @welsmann 原来是这样,感谢。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2370 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.