复位音量为30
import android.media.AudioManager;
private void resetVolume()
{
AudioManager mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 30, AudioManager.FLAG_PLAY_SOUND);
}
复位时区
import android.app.AlarmManager;
import java.util.Locale;
public void resetTimeZone()
{
ContentResolver resolver = mContext.getContentResolver();
String timezone = Settings.System.getString(resolver,"timeZone");
final AlarmManager alarm = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(timezone);
}
设置语言
import com.android.internal.app.LocalePicker;
import java.util.Locale;
public static void resetLanguage(){
//设置语言为英语
Locale loc = new Locale("en","US");
LocalePicker.updateLocale(loc);
}
复位时区
public void resetTimeZone()
{
ContentResolver resolver = mContext.getContentResolver();
String timezone = Settings.System.getString(resolver,"timeZone");
final AlarmManager alarm = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(timezone);
}
清除wifi连接过的信息
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
private void forgetAllWifiConfiguration(Context context) {
Log.d(TAG,"forgetAllWifiConfiguration");
WifiManager wifiMan = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
List<WifiConfiguration> configuredNetworks = wifiMan.getConfiguredNetworks();
if (configuredNetworks == null) {
Log.e(TAG, "failed to get configured networks");
return;
}
for (WifiConfiguration wc : configuredNetworks) {
if (wc != null) {
wifiMan.forget(wc.networkId, null);
Log.d(TAG, "forgot network config: " + wc.toString());
}
}
}