I’m developping a cordova / phonegap android plugin to list wifi around the device.
Into my plugin class, i want to use the WifiManager to do the work.
Here my execute method :
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
Log.d ("WifiLister", "action : " + action);
if ("WifiList".equals(action)) {
wifiList(callbackContext);
return true;
}
return false; // Returning false results in a "MethodNotFound" error.
}
Here my wifiList method :
private void wifiList(CallbackContext callbackContext) throws JSONException{
WifiManager wifiManager = (WifiManager) cordova.getContext().getSystemService(Context.WIFI_SERVICE);
if (!wifiManager.isWifiEnabled()) {
callbackContext.error("Wifi disabled, please turn on Wifi and try again");
}
else{
// do something
}
on the isWifiEnabled method call, i got the following error :
JNI ERROR (app bug): attempt to use stale local reference 0x1
VM aborting
fatal signal 11 (SISEGC) at 0Xdeadd00d (code=1)
I read found the same error with people who wants to make native (C/C++) code into android app, and they have to use the newGlobalRef method to . But it’ not my case, i’m in pure java code.
Any one can help?
Thanks !
Have a look at https://groups.google.com/forum/?fromgroups=#!msg/phonegap/U5U5X07bEUI/TG4VppzazfQJ – it might be a permissions issue.