Giter VIP home page Giter VIP logo

wifitransfer's People

Contributors

gitren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wifitransfer's Issues

How to transfer files via hotspot?

File transfer through hotspot

This project transfers files through wifi to pc.

I want to sent the files through both wifi and hotspot.

This shares files with wifi IP.

public static String getWifiIp(@NonNull Context context) {
    WifiManager wifimanager = (WifiManager) context.getApplicationContext().getSystemService
            (Context.WIFI_SERVICE);
    if (wifimanager == null) {
        return null;
    }
    WifiInfo wifiInfo = wifimanager.getConnectionInfo();
    if (wifiInfo != null) {
        return intToIp(wifiInfo.getIpAddress());
    }
    return null;
    }

    private static String intToIp(int i) {
    return (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + ((i >> 24)
            & 0xFF);
    }

     public static NetworkInfo.State getWifiConnectState(Context context) {
     ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context
            .CONNECTIVITY_SERVICE);
    if (manager == null) {
        return NetworkInfo.State.DISCONNECTED;
    }
    NetworkInfo mWiFiNetworkInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    if (mWiFiNetworkInfo != null) {
        return mWiFiNetworkInfo.getState();
    }
    return NetworkInfo.State.DISCONNECTED;
   }

This code used to get the IP address of wifi. I want to share files through both wifi and hotspot. So, I replaced this code to get both wifi and hotspot IP.

public void getDeviceIpAddress() {
	try {

		for (Enumeration<NetworkInterface> enumeration = NetworkInterface
				.getNetworkInterfaces(); enumeration.hasMoreElements();) {
			NetworkInterface networkInterface = enumeration.nextElement();
			for (Enumeration<InetAddress> enumerationIpAddr = networkInterface
					.getInetAddresses(); enumerationIpAddr
					.hasMoreElements();) {
				InetAddress inetAddress = enumerationIpAddr.nextElement();
				if (!inetAddress.isLoopbackAddress()
						&& inetAddress.getAddress().length == 4) {
					tvServerIP.setText(inetAddress.getHostAddress());
				}
			}
		}
	} catch (SocketException e) {
		Log.e("ERROR:", e.toString());
	}
}

I tried with this code, but it didn't work.

How can I do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.