Android Open Source - WifiPasswordRecover Utils






From Project

Back to project page WifiPasswordRecover.

License

The source code is released under:

Apache License

If you think the Android project WifiPasswordRecover listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright Alexandre Possebom/*from ww  w . jav  a2 s .  co  m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.possebom.openwifipasswordrecover.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.text.TextUtils;

/**
 * Created by alexandre on 17/02/14.
 */
public final class Utils {

    private Utils() {

    }

    // Code from http://stackoverflow.com/questions/8811315/how-to-get-current-wifi-connection-info-in-android
    public static String getCurrentSsid(final Context context) {
        String ssid = null;
        ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        if (networkInfo.isConnected()) {
            final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
            final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
            if (connectionInfo != null && !TextUtils.isEmpty(connectionInfo.getSSID())) {
                ssid = connectionInfo.getSSID().replaceAll("\"", "");
            }
        }
        return ssid;
    }

}




Java Source Code List

com.possebom.openwifipasswordrecover.MainActivity.java
com.possebom.openwifipasswordrecover.adapter.NetworkAdapter.java
com.possebom.openwifipasswordrecover.fragment.AboutFragment.java
com.possebom.openwifipasswordrecover.fragment.NetworkFragment.java
com.possebom.openwifipasswordrecover.interfaces.NetworkListener.java
com.possebom.openwifipasswordrecover.model.Network.java
com.possebom.openwifipasswordrecover.parser.NetworkParser.java
com.possebom.openwifipasswordrecover.util.Utils.java
eu.chainfire.libsuperuser.Application.java
eu.chainfire.libsuperuser.Debug.java
eu.chainfire.libsuperuser.ShellNotClosedException.java
eu.chainfire.libsuperuser.ShellOnMainThreadException.java
eu.chainfire.libsuperuser.Shell.java
eu.chainfire.libsuperuser.StreamGobbler.java