0

Can an Android app change the settings of the phone such as sound on/off or wi-fi on/off? Actually, there will be some predefined NFC tags, and when I tap one of these, let's say, wi-fi will be turned on, or the sound will be turned off? Is that possible with an app?

uploader33
  • 308
  • 1
  • 5
  • 16
  • Here's one answer: http://stackoverflow.com/questions/8863509/how-to-programmatically-turn-off-wifi-on-android-device – emrys57 Nov 28 '12 at 17:08

4 Answers4

1

It is possible to mute the phone with programtically, however to change the WiFi on/off, you need to send the user to settings screen for them to do it manually

Here is a link to mute your phone - Android mute/unmute phone

And here is the code to send the used to settings

startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));

Taken from Android: Changing NFC settings (on/off) programmatically

Community
  • 1
  • 1
jcw
  • 5,132
  • 7
  • 45
  • 54
1

Yes. I would start here in the android docs. This will get you started then take you to the different settings you want to manipulate

codeMagic
  • 44,549
  • 13
  • 77
  • 93
0

Yes, it's possible:

public static void setSilent(Context ctx)
{
    AudioManager am = (AudioManager)ctx.getSystemService(Context.AUDIO_SERVICE);
    am.setRingerMode(AudioManager.RINGER_MODE_SILENT); 
}

public static void setNormal(Context ctx)
{
    AudioManager am = (AudioManager)ctx.getSystemService(Context.AUDIO_SERVICE);
    am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); 
}

And for wifi you can use WifiManager:

wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); 
wifiManager.setWifiEnabled(true);

Note that you need a permission for this: android.permission.CHANGE_WIFI_STATE

Hope that helps!

David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
Adrián Rodríguez
  • 1,836
  • 15
  • 16
0

NFC Task Launcher is an app that does exactly what you're describing:

https://play.google.com/store/apps/details?id=com.jwsoft.nfcactionlauncher

MakeSomething
  • 916
  • 7
  • 9