In my Android application, I let the user choose a Wifi connection for the device. Using WifiConfiguration, I am able to deal with WEP as well as WPA2-PSK networks. However, it appears WPA2-EAP requires one more field - username. Browsing the net, I came across a system class WifiEnterpriseConfig that seems promising. However, this API is available only for OS 4.3+. I am wondering if there is any other way to achieve saving EAP network config that would work for 4.1 and above. Any pointer is appreciated. Regards.
You can just copypaste source code of this class into your project, it should resolve your problem.
Related
I'm trying to develop own Android application using ANT+ sensors.
My app is based on (developer's Sampler code and SDK).
However I found the strange thing during tests. I mean when I start to searching devices I immediately receive a message:
W/AntPluginPcc: BBD30600: RequestAccess failed: OTHER_FAILURE
At first I suppose that a reason of this problem is that I have a phone with Marshmallow OS (instead my wife's phone is based on Lollipop OS and all works fine). I tried to find anything in documentation related this but didn't find anything interesting. I add to Manifest some permissions (I mean com.dsi.ant.permission.ANT, android.permission.BLUETOOTH etc.) and set the permissions in code, but it doesn't help to me to solve my issue.
May be anybody received this problem and may be somebody solve it. Could you please share your solution to me?
P.S. I install the ANT+ Plugin services, ANT Radio Service. in App I use the ANT+ SDK from github. May be I should use also the ANT SDK? (I want to connect to HRM and cycle devices which use ANT+ protocol)
If you have the same problem as I you need to realize the AntRadioServiceConnection class.
I found it here.
And you should be sure that you have all services and plugins installed on your phone.
I am trying to use device mapper in Android, but still stuck on the command "dmsetup" didn't found in Android.
I have loaded the linear.ko and zero.ko which are target device classes successfully in my Android device, but cannot create a virtual device by device mapper because "dmsetup" cannot be found. If anyone know how to get one for Android or have any other methods to create a virtual device?
By the way, I saw a file "device-mapper" in /dev folder, what is used for?
I am really appreciate who can help me on this.
BR,
-Wenji
There is an API that you can use programatically to talk to the device mapper: http://lwn.net/Articles/35077/
This is based around ioctl(), so it's not the friendliest, but it's pretty well documented: http://androidxref.com/4.4.4_r1/xref/bionic/libc/kernel/common/linux/dm-ioctl.h
There is a great example of its use at: https://github.com/nelenkov/cryptsetup, albeit focussed on dm-verity.
How to connect Wii balance board with android?
Is there are any useful Library in android and how to use it?
My goal now is to connect it together and can receive data from it.
I'm new with android and Bluetooth development
I found this answer useful: Is it possible for an android device to read information from the wii controller and nunchuck? (quoted below with thanks to #Ben Mordue)
Have a look at this open source project:
http://code.google.com/p/android-bluez-ime/
Update:
I first installed the APK file on Galaxy Nexus and it works. I have checked the code out of the repo, and it builds fine, and it relatively easy to understand.
It comes in 3 projects - to use Wiimote, you need to install all 3 projects. The one is just used as a flag to allow the service to try for a Wiimote (considering not all ROMs support that level of HID interaction).
I also found these resources on WiiBrew.org:
http://wiibrew.org/wiki/Wiimote
http://wiibrew.org/wiki/Wii_Balance_Board
I used the Wiimote link to understand the Bluez-IME code.
Update 2:
Last night I got the board to communicate with my Android phone correctly. I did this by starting with the Bluez-IME code linked above, and modifying it based on the wiibrew.org info.
The trick is that the Balance Board is like a wiimote with an Extension. So its like a Nunchuk or Classic Controller, but just with a different device ID to look for.
For my initial demo, I just searched for all code that uses a Nunchuk, and duplicated it for a Balance Board. Then to initialise the MODE to use channel 0x32, as per the wiibrew Balance Board page.
Update 3:
I just stumbled across this app on the store: FitScales
And the developer has shared his code on github: paulburton / fitscales
It seems to me that there is a lot of confusing resources regarding the proxy topic on Android.
First of all, it seems that all the methods of the Proxy class are declared deprecated and it's suggested to:
"Use standard java vm proxy values to find the host, port and
exclusion list. This call ignores the exclusion list."
The official java vm proxy values can be accessed in the following way:
System.getProperty("http.proxyHost")
System.getProperty("http.proxyPort")
System.getProperty("http.nonProxyHosts")
This could seem confirmed by the documentation of the ProxySelector class.
But trying on a real device or an emulator, these values seems to me always empty. After looking to the Android source code of the hidden ProxySelector activity, it seems that the proxy is saved into the secure settings of the system in the following way:
Settings.Secure.putString(res, Settings.Secure.HTTP_PROXY, hostname);
And only an application signed by the OS provider can write to the secure settings. Developers can access these settings only in read mode in the following way:
Settings.Secure.getString(getApplicationContext().getContentResolver(),Settings.Secure.HTTP_PROXY);
Someone can clarify if this is the correct reading of how can be access the proxy settings into Android? (At least it seems to work). If this is the correct intepretation, why the documentation is so full of errors?
For getting proxy values, accessing the System properties as you have done should work; it should not be necessary to access secure settings. If you cannot use the System properties to read proxy settings that were made through the normal device UI, then there is a problem. Proxies are per network type, so the APN and WiFi will have separate proxy settings.
I don't know if it's the "right" way to access the proxy settings but it's the right and only way you should access the system "secure settings".
Maybe this is also interesting, looks like it makes things easier, especially if there are Wifi proxys (does Android support something like this?). At least it looks like great abstraction for the various android versions.
I've got an application in the browser that's customized to use Android's browser geolocation APIs. I'd like to find a way to fake the lat/lng that's sent to the browser so I can type in arbitrary coordinates.
In doing some research I came across DDMS - http://developer.android.com/guide/developing/tools/ddms.html - which seems to do what I want, but seems to require the IDE or an emulator. I don't want to use an emulator because I want to test on the device and I don't have the IDE set up for Android.
Does anyone know if there's a way to send mock location data to an Android device without loading up the IDE (or doing it through the emulator)?
I do not believe this is possible -- sorry!
Also the DDMS and IDE solutions are one and the same and only work with the emulator.
Just in case someone stumbles across this question like I did, here is some info about how to mock the LocationProvider on a physical device. Marking this as community wiki because I didn't come up with the original answer. Code is listed in diffract.me/2009/11/android-location-provider-mock (looks like domain is expired as of 9/29/2010, I used Google's cache of the page) & from stackoverflow.com/.../android-mock-location-on-device.