Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to enable/disable wifi or internet

// for android Q and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            Intent panelIntent = new 
Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
            startActivityForResult(panelIntent, 0);
        } else {
            // for previous android version
            WifiManager wifiManager = (WifiManager) 
this.getApplicationContext().getSystemService(WIFI_SERVICE);
            wifiManager.setWifiEnabled(true);
        }
        in AndroidManifest file
//
 <uses-permission
    android:name="android.permission.CHANGE_WIFI_STATE"
    android:required="true" />
Comment

PREVIOUS NEXT
Code Example
Java :: tenth digit is odd in c 
Java :: Java the implements this function will return a copy of the original String that has all characters replaced with plus signs ("+"), with the exception of word string appearances, which are left alone. 
Java :: HashMap to Pojo 
Java :: produces 
Java :: @javax.annotation.Generated error java stub 
Java :: output 
Java :: Reference in java equal operator 
Java :: I/System.out: ep: android.os.NetworkOnMainThreadException 
Java :: android java update image dynamically 
Java :: Lists - removing with iterator 
Java :: Convert Java File to Kotlin File 
Java :: clear datepicker javafx 
Java :: java window always on top 
Java :: tests offline cypress 
Java :: Java Public Access Modifier package two 
Java :: JAVA XML COURSE 
Java :: okhttp Sending and Receiving Network Requests 3 21 
Java :: get value from dynamic input android 
Java :: java singly linked list example 2 res 
Java :: Could not find com.commercehub.gradle.plugin:gradle-avro-plugin:0.10.0. 
Java :: array erstellen java 
Java :: what is void in java 
Java :: how to insert a char at n position java 
Java :: java program finish event 
Java :: rgb code from java color 
Java :: string in java 
Java :: java optional parameters 
Java :: date data type in java 
Java :: Get the number of weeks between two dates 
Java :: types of classes in java 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =