Samsung Galaxy S4 mini — Looking for app, on off for wifi/mobile data and bluetooth

  • Replies:11
  • OpenNot stickiedAnswered

Aug 26, 2013 2:08:16 PM

I like a simple app, click on the icon where you switch off wifi, mobile data or bluetooth or all 3. To save power

I don't know how to make an app

Aug 26, 2013 2:29:57 PM

ok just this code. it;s a sample app which will print in log cat whether wifi mobile or bluetooth is on or off.

Activity Class

package com.example.android_fragment;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;

public class MainActivity extends Activity {
WifiManager wifiManager;
ConnectivityManager mgr;
private BluetoothAdapter mBluetoothAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if(mBluetoothAdapter == null){
System.out.println("BlueTooth adapter not found");


}
//check the status and set the button text accordingly
else {
if (mBluetoothAdapter.isEnabled()) {
System.out.println("BlueTooth is currently switched ON");

}else{
System.out.println("BlueTooth is currently switched OFF");

}
}
// wifiManager.setWifiEnabled(true);
// wifiManager.setWifiEnabled(false);
mgr = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
boolean is3G = mgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
if(is3G){
System.out.println("Data Network is on");
}
else{
System.out.println("Data network is off");
}
boolean check = wifiManager.isWifiEnabled();
if(check){
System.out.println("wifi is working");
}
else{
System.out.println("wifi is off");
}
}

}

default xml file.


Manifest Primission

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

Check out in log cat info. it will print the what u want.

If any query share.

Aug 26, 2013 5:34:45 PM

Just installing Android Studio, hope that compiles apps?

Do you know how the script instead of pressing the on button to put the phone to sleep mode?
like tap an app and the phone sleeps, so no more fiddling about with buttons?

Dec 12, 2013 2:33:07 PM

Ian M.
Hi, Anyone know of an simple on/off app to turn on/off wifi, bluetooth and mobile data for the samsung galaxy s4 mini?

Sorry if i am a bit late to the party here, but why would you need an app for this? Just swipe down from the top of the main page and tap the icon to reverse the setting. Tap the icon in the top right corner to see all the options, then move the ones you want to the top line.