我目前正在编写一个使用Push通知的Android应用程序.我的应用程序已成功注册Google服务器并获取ID,并且我有使用此ID的服务器端代码并将通知推送到收到的应用程序.
当收到推送时,我正在调用一个自定义类,它在一个线程内查询远程服务器以获取将在App中处理的信息.
调用的方法是这样的:
private Thread checkUpdate = new Thread() {
    public void run() {
        try {
            URL updateURL = new URL("http://this.site.com/some/path");
            URLConnection conn = updateURL.openConnection();
            InputStream is = conn.getInputStream();
            BufferedInputStream bis = new BufferedInputStream(is);
            ByteArrayBuffer baf = new ByteArrayBuffer(50);
            int current = 0;
            while ((current = bis.read()) != -1) {
                baf.append((byte) current);
            }
            /* Convert the Bytes read to a String. */
            html = new String(baf.toByteArray());
            mHandler.post(showUpdate);
        } catch (Exception e) {
            // Show message if there was an error with the site.
            Log.e("C2DM", "Exception: " + e.getMessage());
        }
    }
};
LogCat中的行如下:07-31 18:15:59.903:INFO/C2DM(681):异常:null
在LogCat中没有抛出堆栈跟踪,因为我猜错了,但是我不确定究竟是什么引发了异常甚至是什么类型的异常......(虽然我知道它不是IOException,但我试过捕获具体而且它跳过它)
| 归档时间: | 
 | 
| 查看次数: | 8196 次 | 
| 最近记录: |