Code example for ConnectivityManager

Methods: getNetworkInfo

0
    } 
 
    private boolean hasWifiConnection() { 
        final ConnectivityManager manager =
                (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        final NetworkInfo wifiInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        return wifiInfo.isConnected();
    } 
 
    public void doUpload() { 
        final File[] files = mResearchLogDirectory.getUploadableLogFiles();
        if (files == null) return;
        for (final File file : files) {
            uploadFile(file);
        } 
    } 
 
    private void uploadFile(final File file) {
        if (DEBUG) {
            Log.d(TAG, "attempting upload of " + file.getAbsolutePath());
        }