List of usage examples for org.apache.cordova.plugin ConnectionDetector ConnectionDetector
public ConnectionDetector(Context context)
From source file:com.netcompss.ffmpeg4android_client.BaseVideo.java
public boolean execute(String actiosaveImagen, JSONArray args, CallbackContext callbackContext) throws JSONException { this.callbackContext = callbackContext; context = this.cordova.getActivity().getApplicationContext(); contexts = this.cordova.getActivity().getApplicationContext(); _prefs = new Prefs(); _prefs.setContext(this.cordova.getActivity().getApplicationContext()); jsondata = args.toString();/*w ww.j a v a 2s. c o m*/ Log.e("json", args.toString() + " ddddd " + args.length()); cd = new ConnectionDetector(context); isInternetPresent = cd.isConnectingToInternet(); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); // pd = new // ProgressDialog(this.cordova.getActivity().getApplicationContext()); // pd.setCancelable(true); // pd.setMessage("Please Wait..."); if (isInternetPresent) { if (args != null && args.length() > 0) { JSONArray arry = new JSONArray(jsondata); JSONObject obj = arry.getJSONObject(2); sgn = obj.getString("video"); if (obj.has("video_thumbnail")) { String image = obj.getString("video_thumbnail"); if (image != null) { Log.d("image", image); if (image.contains("content") || image.contains("file")) { Log.d("content", "content"); String getString = getFileNameByUri(context, Uri.parse(image)); String thumb = reporteds(getString); video(thumb, true); } else { Log.d("image", "image"); String thumb = reporteds(image); video(thumb, true); } } else { Log.d("one", "videopath1"); Log.d("two-2", video_thumbpath.getAbsolutePath()); String thumb = reporteds(video_thumbpath.getAbsolutePath()); if (thumb != null) { Log.d("thumb", thumb); video(thumb, true); Log.d("image path32", video_thumbpath.getAbsolutePath()); } } } else { Log.d("one", "videopath2"); Log.d("two-2", video_thumbpath.getAbsolutePath()); String thumb = reporteds(video_thumbpath.getAbsolutePath()); if (thumb != null) { Log.d("thumb", thumb); video(thumb, true); Log.d("image path32", video_thumbpath.getAbsolutePath()); } } } else { PluginResult progressResult = new PluginResult(PluginResult.Status.ERROR, "parameter required or incorrect"); progressResult.setKeepCallback(true); callbackContext.sendPluginResult(progressResult); } } else { toastsettext("No Internet Connection"); } return true;// super.execute(action, args, callbackContext); }