private Preference buildMobilePref(Context context) { final TelephonyManager tele = TelephonyManager.from(context); final NetworkTemplate template = NetworkTemplate.buildTemplateMobileAll(tele.getSubscriberId()); final MeteredPreference pref = new MeteredPreference(context, template); pref.setTitle(tele.getNetworkOperatorName()); return pref; }
private Preference buildWifiPref(Context context, WifiConfiguration config) { final String networkId = config.SSID; final NetworkTemplate template = NetworkTemplate.buildTemplateWifi(networkId); final MeteredPreference pref = new MeteredPreference(context, template); pref.setTitle(removeDoubleQuotes(networkId)); return pref; }