I am currently writing an Android app that uses push notifications. My application successfully registers with Google's servers and receives an identifier, and I have a server-side code that uses this identifier and pushes a notification to the application that is received.
When the click is received, I call the user class, which inside the thread requests the remote server for information that will be processed in the application.
The method is called:
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);
}
html = new String(baf.toByteArray());
mHandler.post(showUpdate);
} catch (Exception e) {
Log.e("C2DM", "Exception: " + e.getMessage());
}
}
};
The line in LogCat is as follows: 07-31 18: 15: 59.903: INFO / C2DM (681): exception: null
LogCat , , , , ... ( , IOException, , , )