Of course the vast majority of android devices support wifi but not all of them.
How could someone check to see if the wifi is supported on the current device?
For instance with bluetooth you could just do (in Scala):
def isBluetoothSupported: Boolean = {
BluetoothAdapter.getDefaultAdapter match {
case null => false;
case x: BluetoothAdapter => true;
}
}
What is the corresponding code for wifi?
I don't know Scala, but the relevant API call is:
getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)
The above would allow you to detect whether wifi is available at runtime.
While not directly relevant to your question, another option that might be of use is the "uses-feature" tag element. Adding something like the following to your manifest would filter your application out on Google Play for devices without wifi:
<uses-feature android:name="android.hardware.wifi" android:required="true" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With