Code example for URL

Methods: openConnection, toURI

0
            mNotificationManager.notify(NOTIFICATION_ID, notification);
        } 
    } 
 
    private URLConnection openConnectionWithProxy(URL url) throws java.net.URISyntaxException, java.io.IOException {
        Log.i(LOGTAG, "opening connection with url: " + url);
 
        ProxySelector ps = ProxySelector.getDefault();
        Proxy proxy = Proxy.NO_PROXY;
        if (ps != null) {
            List<Proxy> proxies = ps.select(url.toURI());
            if (proxies != null && !proxies.isEmpty()) {
                proxy = proxies.get(0);
            } 
        } 
 
        return url.openConnection(proxy);
    } 
 
    private UpdateInfo findUpdate(boolean force) {
        try {