Commit a22d90ab authored by Vyacheslav Koshcheyev's avatar Vyacheslav Koshcheyev

add isWifiEnabled method

parent 15279979
......@@ -107,6 +107,17 @@ void QAndroidWiFiLocker::unlock()
bool QAndroidWiFiLocker::isLocked()
{
return java_handler_->callBool("IsLocked");
return java_handler_->callBool("IsLocked");
}
bool QAndroidWiFiLocker::isWifiEnabled()
{
if (java_handler_)
{
return java_handler_->callBool("IsWifiEnabled");
}
return false;
}
......@@ -57,6 +57,7 @@ private:
public:
bool isLocked();
bool isWifiEnabled();
static void preloadJavaClasses();
private:
......
......@@ -148,6 +148,23 @@ class WifiLocker
}
}
public boolean IsWifiEnabled()
{
try
{
WifiManager wifiManager = (WifiManager)getContext().getSystemService(Context.WIFI_SERVICE);
return null != wifiManager && wifiManager.isWifiEnabled();
}
catch (Exception e)
{
Log.e(TAG, "Failed to call isWifiEnabled: " + e);
}
return false;
}
public native Context getContext();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment