Category : android-wifi

i am able to save and connect to wifi using bellow code final ArrayList<WifiNetworkSuggestion> suggestionsList = new ArrayList<WifiNetworkSuggestion>(); WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); final WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder() .setSsid("MyiPhone") .setWpa2Passphrase("[email protected]#") .setIsAppInteractionRequired(true) // Optional (Needs location permission) .build(); final WifiNetworkSuggestion suggestion1 = new WifiNetworkSuggestion.Builder() .setSsid("iPhone") .setWpa2Passphrase("[email protected]#") .setIsAppInteractionRequired(true) // Optional (Needs location permission) .build(); suggestionsList.add(suggestion); suggestionsList.add(suggestion1); ..

Read more

I’m developing an Android app (a game) that supports phones and TVs too, and can play multiplayer via LAN (WiFi or Ethernet) or WiFi Direct. Android Studio warns me with a Lint warning in the manifest that says that if I "require Wifi permissions", then it will "limit the app availability on TVs that support ..

Read more

Manifest (permissions declared and granted) <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> Main class class MainActivity { val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val networkInfo = connectivityManager.activeNetwork val capabilities = connectivityManager.getNetworkCapabilities(networkInfo) if (capabilities?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true) { val wifiInfo = capabilities.transportInfo as WifiInfo Log.d("DEBUG", "ssid: ${wifiInfo.ssid}") } val wifiManager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) ..

Read more