android-wireless

How to forget a wireless network in android programmatically?

落爺英雄遲暮 提交于 2019-11-28 17:54:30
I am working on an app which wifi , where user will be asked to enter password for the scanned network he selects, if user enters a correct password, it connects and works well. But when user enters wrong password, a new network is added with that name, and will be failing to authenticate cos of wrong password, and it will be having authentication problem status. Now if user tries to again scan and select the same network, and enters correct password, it fails to connect even though password now is correct and will have disabled status, since the previous connection is still showing that

Listening WIFI state

こ雲淡風輕ζ 提交于 2019-11-28 12:26:48
I want to set listener to listen on wireless state,can anyone help me with my code import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; ... TelephonyManager wTelephonyManager; ... wTelephonyManager=(TelephonyManager)getSystemService(Context.WIFI_SERVICE); wTelephonyManager.listen(new PhoneL(),PhoneStateListener.LISTEN_DATA_CONNECTION_STATE); connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); //here is the event that i use that i want to listen for wifi change, and the above code is all in onCreate{} class PhoneL extends

Android API call to determine user setting “Data Enabled”

大城市里の小女人 提交于 2019-11-28 10:11:31
My program tries to detect whether a mobile network is available at a certain location. The issue is that when I don't have a data connection it doesn't mean the network is not there... it depends on the user preferences. There are APIs available for NetworkInfo.isAvailable() , and for user settings such as whether user is roaming and roaming is enabled or whether AirplaneMode is on. My problem is that I can't figure out whether the user has data services disabled under Settings/WirelessNetworks/MobileNetworks. Sounds like a trivial problem but I haven't found an API call. In your activity:

WifiManager.getScanResults() - clarifications (automatic scans, sleep etc)

爱⌒轻易说出口 提交于 2019-11-28 06:40:50
问题 I would like some clarifications on the behavior of WifiManager.getScanResults() , namely : When wireless is enabled Does android scan for access points on a fixed interval ? Can one query/change the interval ? Can one query the time of the last scan ? For a discussion see this answer What happens when the wireless radio is turned off (sleeps) - while wifi is still enabled - will getScanResults() go on returning the last scan results ? How would one know if it's time for startScan() ? When

How to get wifi hotspot state

ぐ巨炮叔叔 提交于 2019-11-28 01:02:56
问题 I am creating wifi hotspot in my phone and I want get its state change event when I switched on or off hotspot. 回答1: Please look at the following code. This will help you public class WifiApManager { private final WifiManager mWifiManager; public WifiApManager(Context context) { mWifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); } /*the following method is for getting the wifi hotspot state*/ public WIFI_AP_STATE getWifiApState() { try { Method method = mWifiManager

Listening WIFI state

北城以北 提交于 2019-11-27 07:00:16
问题 I want to set listener to listen on wireless state,can anyone help me with my code import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; ... TelephonyManager wTelephonyManager; ... wTelephonyManager=(TelephonyManager)getSystemService(Context.WIFI_SERVICE); wTelephonyManager.listen(new PhoneL(),PhoneStateListener.LISTEN_DATA_CONNECTION_STATE); connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); //here is the event that i use that i want

Android API call to determine user setting “Data Enabled”

依然范特西╮ 提交于 2019-11-27 03:33:03
问题 My program tries to detect whether a mobile network is available at a certain location. The issue is that when I don't have a data connection it doesn't mean the network is not there... it depends on the user preferences. There are APIs available for NetworkInfo.isAvailable() , and for user settings such as whether user is roaming and roaming is enabled or whether AirplaneMode is on. My problem is that I can't figure out whether the user has data services disabled under Settings