Back to project page WifiCallingControls.
The source code is released under:
MIT License
If you think the Android project WifiCallingControls listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ajhodges.wificallingcontrols.receiver; /* w w w .ja v a 2 s . c om*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.ajhodges.wificallingcontrols.bundle.BundleScrubber; import com.ajhodges.wificallingcontrols.bundle.PluginBundleManager; import com.ajhodges.wificallingcontrols.ipphone.WifiCallingManager; /** * Created by Adam on 3/9/14. */ public class ToggleReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { if(!com.twofortyfouram.locale.Intent.ACTION_FIRE_SETTING.equals(intent.getAction())){ //unexpected intent return; } BundleScrubber.scrub(intent); final Bundle bundle = intent.getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE); BundleScrubber.scrub(bundle); if (PluginBundleManager.isBundleValid(bundle)) { final int mode = bundle.getInt(PluginBundleManager.BUNDLE_EXTRA_INT_MODE); WifiCallingManager wifiCallingManager = WifiCallingManager.getInstance(context); if(mode < WifiCallingManager.PREFER_WIFI) { wifiCallingManager.toggleWifi(context, mode); context.getSharedPreferences("ToggleWidgetProvider", Context.MODE_PRIVATE).edit().putBoolean("widgetUpdating", false); } else { wifiCallingManager.setPreferred(context, mode); } } } }