I hope title itself says what my question is...
For example, We can check the Wifi availability with PackageManager like
packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI);
Similarly is there any way to detect Mobile hotspot feature availability in Android programmatically?
Thanks.
i went through google documentation and found that if wifi P2P is supported by device then its obvious it suports wifi hotspot
to check Wi-Fi Direct/ wifi P2P by device then check this way
PackageManager m = getPackageManager();
     if (!m.hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT)) {
            // This device does support wifi P2P
        }
but google says its better to check for this support in your broadcast receiver itself this way
@Override
public void onReceive(Context context, Intent intent) {
    ...
    String action = intent.getAction();
    if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
        int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
        if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
            // Wifi P2P is enabled
        } else {
            // Wi-Fi P2P is not enabled
        }
    }
    ...
}
check google documentation for same
The is maybe the first step to the solution.
See: Android Wifi Hotspot Manager Class
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