since we can set wireless access point in android device from device settings,
then through android application i want to retrieve already set access point information like name,ip address,port number etc.Any idea/sample code/links how to do this?
Related
I am trying to read the Preferred network type setting from the device. But nowhere android API's are available.
Use case:
Trying to read the Preferred network type and connected network type so that if the device has LTE enabled and the user is forcefully switched back to the lower network(3G,2G); then there should be a notification sent to the user.
I have checked the system setting code, But it's deprecated.
Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.System.NETWORK_PREFERENCE);
Is there any alternate way to read the system secured settings(By reflection?).
And Also is it possible to write back the setting with the user permission?
Help is much appreciated.
I think the right code is:
Settings.Global.getString(context.getContentResolver(),Settings.Global.NETWORK_PREFERENCE)
Not able to understand WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN, which is introduced in Android M. .However the definition in android developer site is very ambiguous.Please anyone clarify about this varible
WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN - is the defined user wifi configuration state (true means its locked, false means its changeable).
from android documentation :
http://developer.android.com/reference/android/provider/Settings.Global.html
This setting controls whether WiFi configurations created by a Device
Owner app should be locked down (that is, be editable or removable
only by the Device Owner App, not even by Settings app).
since Marshmallow this configurations have been changed and now are accessible only if you produce your own configuration per application using specific API's.
please refer to Android 6.0 Changes.
https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html
Your apps can now change the state of WifiConfiguration objects only
if you created these objects. You are not permitted to modify or
delete WifiConfiguration objects created by the user or by other apps.
hope it clarifies a bit.
Is there a way to get my current Wifi-Direct device name without listening to WIFI_P2P_THIS_DEVICE_CHANGED_ACTION ? If wifi is already enabled I guess I cannot receive that intent.
I'm developing an app to create a WiFi direct group and share devices locations between peers. When I open a group I need to initialize a data structure, a map in the form of ( deviceName, lastLocation) with my location. A group is created by the user when pressing a button.
You will get WIFI_P2P_THIS_DEVICE_CHANGED_ACTION when you register for the WifiP2pBroadcastReceiver, it doesn't matter if wifi is already on.
Quote
I am working on user speed calculation application where I used 'Network provider' to get location. I just want to know that how I know that whether 'Wireless Network' flag to access user current location is enabled or not.
For clarification Flag path : Setting -> Location & Securtiy -> Use Wireless network.
(Setting path from LG device.)
And also can we able to toggle this flag through code.
If any one known about this then please let me know, thanks in advanced.
This preference is present in Settings.secure. So you cannot write such a setting programmatically. This has to be specifically enabled by User. Check this link http://developer.android.com/reference/android/provider/Settings.Secure.html
i have create custom WiFi setting UI in android application but i am struggle to get security name like (WPA/WPA2/PSK) i.e when user click on the WiFi list item so it display network information like Status , signal strength etc. all information accessed except Security.
i have tried WIFi configuration , manager but i am not able to get exact security name please help me how to get this thing
i am attach screen shot for more understanding.