Java Code Examples for org.apache.cordova.CordovaResourceApi#remapUri()
The following examples show how to use
org.apache.cordova.CordovaResourceApi#remapUri() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
@Override @SuppressWarnings("deprecation") public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 2
Source File: X5WebViewClient.java From cordova-plugin-x5engine-webview with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 3
Source File: SystemWebViewClient.java From countly-sdk-cordova with MIT License | 5 votes |
@Override @SuppressWarnings("deprecation") public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 4
Source File: SystemWebViewClient.java From lona with GNU General Public License v3.0 | 5 votes |
@Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 5
Source File: XWalkCordovaResourceClient.java From cordova-crosswalk-engine with Apache License 2.0 | 5 votes |
@Override public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) { try { // Check the against the white-list. if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri)) { OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 6
Source File: SystemWebViewClient.java From pychat with MIT License | 5 votes |
@Override @SuppressWarnings("deprecation") public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 7
Source File: SystemWebViewClient.java From chappiecast with Mozilla Public License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 8
Source File: SystemWebViewClient.java From cordova-plugin-intent with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 9
Source File: SystemWebViewClient.java From a2cardboard with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 10
Source File: SystemWebViewClient.java From cordova-plugin-app-update-demo with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 11
Source File: SystemWebViewClient.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 12
Source File: SystemWebViewClient.java From app-icon with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 13
Source File: X5WebViewClient.java From cordova-plugin-x5-tbs with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 14
Source File: SystemWebViewClient.java From keemob with MIT License | 5 votes |
@Override @SuppressWarnings("deprecation") public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 15
Source File: X5WebViewClient.java From cordova-plugin-x5-webview with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 16
Source File: X5WebViewClient.java From x5webview-cordova-plugin with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 17
Source File: SystemWebViewClient.java From ultimate-cordova-webview-app with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 18
Source File: SystemWebViewClient.java From xmall with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { try { // Check the against the whitelist and lock out access to the WebView directory // Changing this will cause problems for your application if (!parentEngine.pluginManager.shouldAllowRequest(url)) { LOG.w(TAG, "URL blocked by whitelist: " + url); // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } CordovaResourceApi resourceApi = parentEngine.resourceApi; Uri origUri = Uri.parse(url); // Allow plugins to intercept WebView requests. Uri remappedUri = resourceApi.remapUri(origUri); if (!origUri.equals(remappedUri) || needsSpecialsInAssetUrlFix(origUri) || needsKitKatContentUrlFix(origUri)) { CordovaResourceApi.OpenForReadResult result = resourceApi.openForRead(remappedUri, true); return new WebResourceResponse(result.mimeType, "UTF-8", result.inputStream); } // If we don't need to special-case the request, let the browser load it. return null; } catch (IOException e) { if (!(e instanceof FileNotFoundException)) { LOG.e(TAG, "Error occurred while loading a file (returning a 404).", e); } // Results in a 404. return new WebResourceResponse("text/plain", "UTF-8", null); } }
Example 19
Source File: VideoPlayer.java From cordova-plugin-videoplayer with MIT License | 4 votes |
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArray of arguments for the plugin. * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. */ public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException { if (action.equals("play")) { this.callbackContext = callbackContext; CordovaResourceApi resourceApi = webView.getResourceApi(); String target = args.getString(0); final JSONObject options = args.getJSONObject(1); String fileUriStr; try { Uri targetUri = resourceApi.remapUri(Uri.parse(target)); fileUriStr = targetUri.toString(); } catch (IllegalArgumentException e) { fileUriStr = target; } Log.v(LOG_TAG, fileUriStr); final String path = stripFileProtocol(fileUriStr); // Create dialog in new thread cordova.getActivity().runOnUiThread(new Runnable() { public void run() { openVideoDialog(path, options); } }); // Don't return any result now PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); callbackContext = null; return true; } else if (action.equals("close")) { if (dialog != null) { if(player.isPlaying()) { player.stop(); } player.release(); dialog.dismiss(); } if (callbackContext != null) { PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(false); // release status callback in JS side callbackContext.sendPluginResult(result); callbackContext = null; } return true; } return false; }