V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
liuxu
V2EX  ›  程序员

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

  •  
  •   liuxu · Feb 25, 2015 · 3925 views
    This topic created in 4090 days ago, the information mentioned may be changed or developed.
    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 replies    2015-02-26 09:46:14 +08:00
    welsmann
        1
    welsmann  
       Feb 25, 2015   ❤️ 1
    这个接口经常任性的,返回的数据格式有时候会不一致。
    很显然它又任性了一把。
    liuxu
        2
    liuxu  
    OP
       Feb 26, 2015
    @welsmann 原来是这样,感谢。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 03:57 · PVG 11:57 · LAX 20:57 · JFK 23:57
    ♥ Do have faith in what you're doing.