List of usage examples for org.apache.cordova PluginResult setKeepCallback
public void setKeepCallback(boolean b)
From source file:me.tassoevan.cordova.CallStateListener.java
License:Open Source License
public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); if (this.callbackContext == null) { return;//from w w w . java2 s . c o m } String msg; switch (state) { case TelephonyManager.CALL_STATE_IDLE: msg = PHONE_STATE_IDLE; break; case TelephonyManager.CALL_STATE_OFFHOOK: msg = PHONE_STATE_OFFHOOK; break; case TelephonyManager.CALL_STATE_RINGING: msg = PHONE_STATE_RINGING; break; default: msg = PHONE_STATE_UNKNOWN; } PluginResult result = new PluginResult(PluginResult.Status.OK, msg); result.setKeepCallback(true); callbackContext.sendPluginResult(result); }
From source file:net.atlaslearning.cordova.OpenIn.OpenIn.java
License:Apache License
/** * Executes the request./* w w w .ja v a 2 s . com*/ * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackContext The callback context used when calling back into JavaScript. * @return True if the action was valid, false if not. */ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { if (action.equals("start")) { if (this.batteryCallbackContext != null) { callbackContext.error("Battery listener already running."); return true; } this.batteryCallbackContext = callbackContext; // We need to listen to power events to update battery status IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED); if (this.receiver == null) { this.receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateBatteryInfo(intent); } }; cordova.getActivity().registerReceiver(this.receiver, intentFilter); } // Don't return any result now, since status results will be sent when events come in from broadcast receiver PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); return true; } else if (action.equals("stop")) { removeBatteryListener(); this.sendUpdate(new JSONObject(), false); // release status callback in JS side this.batteryCallbackContext = null; callbackContext.success(); return true; } return false; }
From source file:net.atlaslearning.cordova.OpenIn.OpenIn.java
License:Apache License
/** * Create a new plugin result and send it back to JavaScript * * @param connection the network info to set as navigator.connection *///from w w w .j a v a 2s . c om private void sendUpdate(JSONObject info, boolean keepCallback) { if (this.batteryCallbackContext != null) { PluginResult result = new PluginResult(PluginResult.Status.OK, info); result.setKeepCallback(keepCallback); this.batteryCallbackContext.sendPluginResult(result); } }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { boolean valueSDK = true; Log.d(TAG, "Arguments received : " + args); JSONObject arg_object = null;//from w w w .j a v a2s .c om this.myContext = this.cordova.getActivity().getApplicationContext(); this.myApplication = this.cordova.getActivity().getApplication(); Log.d(TAG, "Context reference: " + this.myContext.toString()); this.DSBSDK = DSB.sdk(this.myContext); if (args.length() > 0) { arg_object = args.getJSONObject(0); } Log.d(TAG, "Action called: " + action); if (action.equals("init")) { String licenseKey = arg_object.getString("licenseKey"); if (licenseKey != null) { Log.d(TAG, "licenseKey for init service: " + licenseKey); this.DSBSDK.init(licenseKey); Log.d(TAG, "DSBSDK init method was called"); callbackContext.success(); } else { callbackContext.error(BuildConfig.FLAVOR); valueSDK = false; } } else { boolean enabled; if (action.equals("setAutomaticUpdateEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.setAutomaticUpdateEnabled(enabled); Log.d(TAG, "DSBSDK setAutomaticUpdateEnabled method was called"); callbackContext.success(); } else { if (action.equals("setAutomaticUpdateInterval")) { long updateInterval = arg_object.getLong("updateInterval"); this.DSBSDK.setAutomaticUpdateInterval(1000 * updateInterval); Log.d(TAG, "DSBSDK setAutomaticUpdateInterval method was called"); callbackContext.success(); } else { if (action.equals("setEventsReportingEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.setEventsReportingEnabled(enabled); Log.d(TAG, "DSBSDK setEventsReportingEnabled method was called"); callbackContext.success(); } else { if (action.equals("setEventReportingUsername")) { String userName = arg_object.getString("userName"); int publicKeyId = arg_object.getInt("publicKeyId"); boolean cipher = arg_object.getBoolean("cipher"); if (userName != null) { this.DSBSDK.setEventReportingUsername(userName, publicKeyId, cipher); Log.d(TAG, "DSBSDK setEventReportingUsername method was called"); callbackContext.success(); } else { valueSDK = false; callbackContext.error(BuildConfig.FLAVOR); } } else { PluginResult pluginResult; if (action.equals("setPreUpdateListener")) { Log.d(TAG, "DSBSDK setPreUpdateListener method is called"); this.DSBSDK.setUpdateListener(this); this.callbackContextPreUpdate = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setPreUpdateListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("setPostUpdateListener")) { Log.d(TAG, "DSBSDK setPostUpdateListener method is called"); this.DSBSDK.setUpdateListener(this); this.callbackContextPostUpdate = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setPostUpdateListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("getInformationAPI")) { String informationAPI = this.DSBSDK.getInformationAPI(); Log.d(TAG, "DSBSDK getInformationAPI method was called: " + informationAPI); callbackContext.success(informationAPI); } else { if (action.equals("scanDeviceStatus")) { this.DSBSDK.DEVICE_PROTECTOR_API.scanDeviceStatus(); Log.d(TAG, "DSBSDK scanDeviceStatus method was called"); callbackContext.success(); } else { if (action.equals("scanDeviceHosts")) { boolean status = this.DSBSDK.DEVICE_PROTECTOR_API.scanDeviceHosts(); Log.d(TAG, "DSBSDK scanDeviceHosts method was called"); callbackContext.success(Boolean.toString(status)); } else { if (action.equals("restoreDeviceHosts")) { this.DSBSDK.DEVICE_PROTECTOR_API.restoreDeviceHosts(); Log.d(TAG, "DSBSDK restoreDeviceHosts method was called"); callbackContext.success(); } else { if (action.equals("setScanDeviceListener")) { Log.d(TAG, "DSBSDK setScanDeviceListener method is called"); this.DSBSDK.DEVICE_PROTECTOR_API .setEventsReportListener(this); this.callbackContextScanDevice = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setScanDeviceListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("setScanHostListener")) { Log.d(TAG, "DSBSDK setScanHostListener method is called"); this.DSBSDK.DEVICE_PROTECTOR_API .setEventsReportListener(this); this.callbackContextScanHost = callbackContext; pluginResult = new PluginResult(Status.NO_RESULT); pluginResult.setKeepCallback(true); Log.d(TAG, "DSBSDK setScanHostListener method was called"); callbackContext.sendPluginResult(pluginResult); } else { if (action.equals("isDeviceRooted")) { boolean isDeviceRooted = this.DSBSDK.DEVICE_PROTECTOR_API .isDeviceRooted(); Log.d(TAG, "DSBSDK isDeviceRooted method was called: " + isDeviceRooted); callbackContext .success(Boolean.toString(isDeviceRooted)); } else { if (action .equals("isDeviceAllowingUnknownSources")) { boolean isDeviceAllowUnknowSources = this.DSBSDK.DEVICE_PROTECTOR_API .isDeviceAllowingUnknownSources(); Log.d(TAG, "DSBSDK isDeviceAllowingUnknownSources method was called: " + isDeviceAllowUnknowSources); callbackContext.success(Boolean .toString(isDeviceAllowUnknowSources)); } else { if (action.equals( "setBrowsingMalwareGUINotificationEnabled")) { enabled = arg_object.getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setBrowsingMalwareGUINotificationEnabled( enabled); Log.d(TAG, "DSBSDK setBrowsingMalwareGUINotificationEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setWebProtectionEnabled")) { enabled = arg_object .getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setWebProtectionEnabled( enabled); Log.d(TAG, "DSBSDK setWebProtectionEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setWebBlockingEnabled")) { enabled = arg_object .getBoolean("enabled"); this.DSBSDK.WEB_PROTECTOR_API .setWebBlockingEnabled( enabled); Log.d(TAG, "DSBSDK setWebBlockingEnabled method was called"); callbackContext.success(); } else { if (action.equals( "setBrowsingPhishingListener")) { Log.d(TAG, "DSBSDK setBrowsingPhishingListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingPhishing = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback(true); Log.d(TAG, "DSBSDK setBrowsingPhishingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action.equals( "setBrowsingMalwareListener")) { Log.d(TAG, "DSBSDK setBrowsingMalwareListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingMalware = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingMalwareListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action.equals( "setBrowsingPharmingListener")) { Log.d(TAG, "DSBSDK setBrowsingPharmingListener method is called"); this.DSBSDK.WEB_PROTECTOR_API .setEventsReportListener( this); this.callbackContextBrowsingPharming = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingPharmingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { String drawableName; String title; String message; int id; if (action.equals( "configureBrowsingMalwareGUINotification")) { try { drawableName = arg_object .getString( "drawableName"); if (arg_object .getString( "title") .equals("null")) { title = null; } else { title = arg_object .getString( "title"); } if (arg_object .getString( "message") .equals("null")) { message = null; } else { message = arg_object .getString( "message"); } id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.WEB_PROTECTOR_API .configureBrowsingMalwareGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was called"); callbackContext .success(); } catch (Exception e) { Log.d(TAG, e .getMessage()); this.DSBSDK.WEB_PROTECTOR_API .configureBrowsingMalwareGUINotification( 0, null, null); Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was configure by default"); callbackContext .error("resource not found"); } } else { if (action.equals( "startMalwareScanning")) { this.DSBSDK.MALWARE_PROTECTOR_API .startMalwareScanning(); Log.d(TAG, "DSBSDK startMalwareScanning method was called"); callbackContext .success(); } else { if (action .equals("setMalwareAppScanListener")) { Log.d(TAG, "DSBSDK setMalwareAppScanListener method is called"); this.DSBSDK.MALWARE_PROTECTOR_API .setEventsReportListener( this); this.callbackContextMalwareAppScan = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setBrowsingPharmingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("setMalwareResultDialogEnable")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareResultDialogEnable( enabled); Log.d(TAG, "DSBSDK setMalwareResultDialogEnable method was called"); callbackContext .success(); } else { if (action .equals("setMalwareInstallGUINotificationEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareInstallGUINotificationEnabled( enabled); Log.d(TAG, "DSBSDK setMalwareInstallGUINotificationEnabled method was called"); callbackContext .success(); } else { if (action .equals("setAutomaticMalwareScanEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setAutomaticMalwareScanEnabled( enabled); Log.d(TAG, "DSBSDK setAutomaticMalwareScanEnabled method was called"); callbackContext .success(); } else { if (action .equals("setMalwareScanOnInstallationEnabled")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.MALWARE_PROTECTOR_API .setMalwareScanOnInstallationEnabled( enabled); Log.d(TAG, "DSBSDK setMalwareScanOnInstallationEnabled method was called"); callbackContext .success(); } else { if (action .equals("configureInstallCertificateAppGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallCertificateAppGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureInstallCertificateAppGUINotification method was called"); callbackContext .success(); } catch (Exception e2) { Log.d(TAG, "DSBSDK configureBrowsingMalwareGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallCertificateAppGUINotification( 0, null, null); Log.d(TAG, e2.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("configureInstallMalwareAppGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureInstallMalwareAppGUINotification method was called"); callbackContext .success(); } catch (Exception e22) { Log.d(TAG, "DSBSDK configureInstallMalwareAppGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( 0, null, null); Log.d(TAG, e22.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("startOverlappingProtection")) { this.DSBSDK.MALWARE_PROTECTOR_API .startOverlappingProtection( this.myApplication); Log.d(TAG, "DSBSDK startOverlappingProtection method was called"); callbackContext .success(); } else { if (action .equals("addOverlayListener")) { Log.d(TAG, "DSBSDK addOverlayListener method is called"); this.DSBSDK.MALWARE_PROTECTOR_API .addOverlayListener( this); this.callbackContextOverlayAttack = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK addOverlayListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("configureOverlappingMalwareGUINotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.MALWARE_PROTECTOR_API .configureOverlappingMalwareGUINotification( id, title, message); Log.d(TAG, "DSBSDK configureOverlappingMalwareGUINotification method was called"); callbackContext .success(); } catch (Exception e222) { Log.d(TAG, "DSBSDK configureOverlappingMalwareGUINotification method was configure by default"); this.DSBSDK.MALWARE_PROTECTOR_API .configureInstallMalwareAppGUINotification( 0, null, null); Log.d(TAG, e222.getMessage()); callbackContext .error("resource not found"); } } else { String url; if (action .equals("isSecureConnection")) { url = arg_object .getString( ProtectedSite.URL); if (url != null) { Log.d(TAG, "DSBSDK isSecureConnection method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureConnectionTask( url, callbackContext)); } else { valueSDK = false; callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("isSecureCertificate")) { url = arg_object .getString( ProtectedSite.URL); if (url != null) { Log.d(TAG, "DSBSDK isSecureCertificate method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureCertificateTask( url, callbackContext)); } else { valueSDK = false; callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("isSecureByRiskRules")) { Log.d(TAG, "DSBSDK isSecureByRiskRules method was called"); pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); callbackContext .sendPluginResult( pluginResult); this.cordova .getThreadPool() .execute( new SecureByRiskRulesTask( callbackContext)); } else { if (action .equals("setCertificateFailingListener")) { Log.d(TAG, "DSBSDK setCertificateFailingListener method is called"); this.DSBSDK.CONNECTION_PROTECTOR_API .setBlockingConnectionResponseListener( this); this.callbackContextCertificateFailing = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setCertificateFailingListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("setRiskBlockingConnectionListener")) { Log.d(TAG, "DSBSDK setRiskBlockingConnectionListener method is called"); this.DSBSDK.CONNECTION_PROTECTOR_API .setBlockingConnectionResponseListener( this); this.callbackContextRiskBlockingConnection = callbackContext; pluginResult = new PluginResult( Status.NO_RESULT); pluginResult .setKeepCallback( true); Log.d(TAG, "DSBSDK setRiskBlockingConnectionListener method was called"); callbackContext .sendPluginResult( pluginResult); } else { if (action .equals("enableUnknownAppBlockingConnection")) { enabled = arg_object .getBoolean( "enabled"); this.DSBSDK.CONNECTION_PROTECTOR_API .enableUnknownAppBlockingConnection( enabled); Log.d(TAG, "DSBSDK enableUnknownAppBlockingConnection method was called"); callbackContext .success(); } else { if (action .equals("configureSMSFilterNumbers")) { try { JSONArray arr = arg_object .getJSONArray( "senderNumber"); String[] senderNumber = new String[arr .length()]; for (int i = 0; i < arr .length(); i++) { senderNumber[i] = arr .getString( i); } this.DSBSDK.SMS_PROTECTOR_API .configureSMSFilterNumbers( senderNumber); Log.d(TAG, "DSBSDK configureSMSFilterNumbers method was called"); callbackContext .success(); } catch (Exception e2222) { Log.d(TAG, "DSBSDK configureSMSFilterNumbers method was configure by default"); Log.d(TAG, e2222.getMessage()); callbackContext .error(BuildConfig.FLAVOR); } } else { if (action .equals("displaySecuredSMS")) { this.DSBSDK.SMS_PROTECTOR_API .displaySecuredSMS(); Log.d(TAG, "DSBSDK displaySecuredSMS method was called"); callbackContext .success(); } else { if (action .equals("scanInboxSMS")) { this.DSBSDK.SMS_PROTECTOR_API .scanInboxSMS(); Log.d(TAG, "DSBSDK scanInboxSMS method was called"); callbackContext .success(); } else { if (action .equals("configureRogueSMSNotification")) { drawableName = arg_object .getString( "drawableName"); title = arg_object .getString( "title"); message = arg_object .getString( "message"); try { id = this.myContext .getResources() .getIdentifier( drawableName, "drawable", this.myContext .getPackageName()); Log.d(TAG, "drawable: " + drawableName + " with id: " + id); this.DSBSDK.SMS_PROTECTOR_API .configureRogueSMSNotification( id, title, message); Log.d(TAG, "DSBSDK configureRogueSMSNotification method was called"); callbackContext .success(); } catch (Exception e22222) { Log.d(TAG, "DSBSDK configureRogueSMSNotification method was configure by default"); this.DSBSDK.SMS_PROTECTOR_API .configureRogueSMSNotification( 0, null, null); Log.d(TAG, e22222.getMessage()); callbackContext .error("resource not found"); } } else { if (action .equals("getAllSecuredSMS")) { this.cordova .getThreadPool() .execute( new C02331( callbackContext)); } else { if (action .equals("deleteSecuredSMS")) { JSONObject jSONObject = new JSONObject( arg_object .getString( "sms")); for (SMSObject sms : this.DSBSDK.SMS_PROTECTOR_API .getAllSecuredSMS()) { if (sms.getTimestampMillis() == jSONObject .getLong( SMSProtectorPreferences.TIMESTAPMILLIS)) { this.DSBSDK.SMS_PROTECTOR_API .deleteSecuredSMS( sms); break; } } Log.d(TAG, "DSBSDK deleteSecuredSMS method was called"); callbackContext .success(); } else { if (action .equals("deleteAllSecuredSMS")) { this.DSBSDK.SMS_PROTECTOR_API .deleteAllSecuredSMS(); Log.d(TAG, "DSBSDK deleteAllSecuredSMS method was called"); callbackContext .success(); } else { valueSDK = false; Log.d(TAG, "Method " + action + " is not defined on DSB SDK "); callbackContext .error("not supported methos"); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } Log.d(TAG, "Returned valueSDK: " + valueSDK); return valueSDK; }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onPreUpdate() { Log.d(TAG, "Preupdate response"); if (this.callbackContextPreUpdate != null) { Log.d(TAG, "From Preupdate callback"); PluginResult result = new PluginResult(Status.OK); result.setKeepCallback(true); this.callbackContextPreUpdate.sendPluginResult(result); }//from www. ja va2 s. c om }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onPostUpdate() { Log.d(TAG, "PostUpdate response"); if (this.callbackContextPostUpdate != null) { Log.d(TAG, "From PostUpdate callback"); PluginResult result = new PluginResult(Status.OK); result.setKeepCallback(true); this.callbackContextPostUpdate.sendPluginResult(result); }/*www .j a v a2 s . com*/ }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onScanDeviceStateEvent(Map<String, String> eventMap) { Log.d(TAG, "Scan device event "); if (this.callbackContextScanDevice != null) { Log.d(TAG, "From Scan device event"); try {// w w w . j a v a 2 s . com PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextScanDevice.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onScanHostsEvent(Map<String, String> eventMap) { Log.d(TAG, "Scan host event "); if (this.callbackContextScanHost != null) { Log.d(TAG, "From host device event"); try {/*from w w w . ja v a 2s. c o m*/ PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextScanHost.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onBrowsingPhishingEvent(Map<String, String> eventMap) { Log.d(TAG, "report Phishing events "); if (this.callbackContextBrowsingPhishing != null) { Log.d(TAG, "From Phishing events "); try {/*from ww w .java 2 s . c o m*/ PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextBrowsingPhishing.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } }
From source file:net.easysol.dsb.DSBSDKCordovaPlugin.java
public void onBrowsingMalwareAppEvent(Map<String, String> eventMap) { Log.d(TAG, "report malware events "); if (this.callbackContextBrowsingMalware != null) { Log.d(TAG, "From malware events "); try {//from w ww .j a v a 2 s .c o m PluginResult result = new PluginResult(Status.OK, new JSONObject(eventMap)); result.setKeepCallback(true); this.callbackContextBrowsingMalware.sendPluginResult(result); } catch (Exception e) { Log.i(TAG, e.getMessage()); } } }