You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think your changes in java would compile properly as the code requires all of those libraries to work properly.
I haven't tried this but according to phonegap2.2 API, you should only need to update the execute method in deviceinformation.java to something like this:
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("get")) {
TelephonyManager tm = (TelephonyManager) this.cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE);
AccountManager am = AccountManager.get(this.cordova.getActivity());
String result = getDetails(tm,am);
if (result != null) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
return true;
}
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
return false;
}
Try to implement this plugin on a project with phonegap 2 .. 2.
In java change:
org.apache.cordova.api.CallbackContext import;
org.apache.cordova.api.CordovaPlugin import;
org.apache.cordova.api.PluginResult import;
Compiles ok.
In HTML use:
var deviceInfo = cordova.require("cordova/plugin/DeviceInformation");
alert('start');
deviceInfo.get(function(result) {
alert("result = " + result);
}, function() {
alert("error");
});
alert ('final');
But dont alert "start".
More info:
package com.mobilesoftware.cordova.plugins;
How should initialize the variable deviceInfo ? thanks
The text was updated successfully, but these errors were encountered: