ANDROID APP

Tips on how to swap Wifi On and Off routinely or remotely in your Android App? – Full Supply Code



This video reveals the steps to create an Android App which can be utilized to regulate the state of your Wifi between ON and OFF. The idea proven on this video may be very easy. Nonetheless, the use instances to regulate the state of the wifi could possibly be many which has been briefly mentioned on this video. A few of the use instances could possibly be to regulate the wifi remotely by sending the command over channels reminiscent of SMS, firebase database replace, and so on. It can be managed at a pre-set time utilizing some sort of timer or alarm clock idea.

We hope you want this video. For any question, solutions or appreciations we will probably be glad to listen to from you at: [email protected]

Supply Code at:

https://programmerworld.co/android/how-to-switch-wifi-on-and-off-automatically-or-remotely-in-your-android-app-complete-source-code/

package deal com.instance.mywificontrolapp;

import androidx.appcompat.app.AppCompatActivity;
import android.content material.Context;
import android.internet.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {
non-public WifiManager wifiManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
tremendous.onCreate(savedInstanceState);
setContentView(R.format.activity_main);
wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
}

public void WifiOnButton(View view){
wifiManager.setWifiEnabled(true);
}

public void WifiOffButton(View view){
wifiManager.setWifiEnabled(false);
}
}

source