com.androidnetworking.AndroidNetworking Java Examples
The following examples show how to use
com.androidnetworking.AndroidNetworking.
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: SendVid.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { String src = getSrc(response); if (src!=null){ ArrayList<XModel> xModels = new ArrayList<>(); putModel(src,"Normal",xModels); onTaskCompleted.onTaskCompleted(xModels,false); }else onTaskCompleted.onError(); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #2
Source File: MvpApp.java From android-mvp-architecture with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); mApplicationComponent = DaggerApplicationComponent.builder() .applicationModule(new ApplicationModule(this)).build(); mApplicationComponent.inject(this); AppLogger.init(); AndroidNetworking.initialize(getApplicationContext()); if (BuildConfig.DEBUG) { AndroidNetworking.enableLogging(Level.BODY); } CalligraphyConfig.initDefault(mCalligraphyConfig); }
Example #3
Source File: MvvmApp.java From android-mvvm-architecture with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); DaggerAppComponent.builder() .application(this) .build() .inject(this); AppLogger.init(); AndroidNetworking.initialize(getApplicationContext()); if (BuildConfig.DEBUG) { AndroidNetworking.enableLogging(HttpLoggingInterceptor.Level.BODY); } CalligraphyConfig.initDefault(mCalligraphyConfig); }
Example #4
Source File: MvpApp.java From android-mvp-interactor-architecture with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); mApplicationComponent = DaggerApplicationComponent.builder() .applicationModule(new ApplicationModule(this)).build(); mApplicationComponent.inject(this); AppLogger.init(); AndroidNetworking.initialize(getApplicationContext()); if (BuildConfig.DEBUG) { AndroidNetworking.enableLogging(Level.BODY); } CalligraphyConfig.initDefault(mCalligraphyConfig); }
Example #5
Source File: DJILogger.java From Android-Bridge-App with MIT License | 5 votes |
@Override public void run() { while (isNetworkEnabled) { if (messageQueue.size() > 0) { final JSONObject object = messageQueue.remove(0); AndroidNetworking.post(serverURL).addBodyParameter("data", object.toString()).build() .getAsOkHttpResponse(new OkHttpResponseListener() { @Override public void onResponse(Response response) { //DO Nothing } @Override public void onError(ANError anError) { Log.e(TAG, "Error: " + anError); } }); } } }
Example #6
Source File: Muvix.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ AndroidNetworking.get(fixURL(url)) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parse(response); if (xModels!=null){ onComplete.onTaskCompleted(xModels,true); }else onComplete.onError(); } @Override public void onError(ANError anError) { onComplete.onError(); } }); }
Example #7
Source File: Vlare.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels.isEmpty()){ onTaskCompleted.onError(); }else onTaskCompleted.onTaskCompleted(Utils.sortMe(xModels), true); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #8
Source File: BitTube.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ String id = getBitTubeID(url); if (id!=null) { AndroidNetworking.get("https://bittube.video/api/v1/videos/" + id) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels.isEmpty()) { onTaskCompleted.onError(); } else onTaskCompleted.onTaskCompleted(Utils.sortMe(xModels), true); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }else onTaskCompleted.onError(); }
Example #9
Source File: GPhotos.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .setUserAgent(LowCostVideo.agent) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = GPhotosUtils.getGPhotoLink(response); onTaskCompleted.onTaskCompleted(xModels,true); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #10
Source File: VideoBIN.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels.isEmpty()) { onTaskCompleted.onError(); } else onTaskCompleted.onTaskCompleted(Utils.sortMe(xModels), true); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #11
Source File: Vudeo.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels.isEmpty()){ onTaskCompleted.onError(); }else onTaskCompleted.onTaskCompleted(xModels, false); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #12
Source File: MFire.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(fixURL(url)) .addHeaders("User-agent", agent) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { final String regex = "aria-label=\"Download file\"\\n.+href=\"(.*)\""; final Pattern pattern = Pattern.compile(regex); final Matcher matcher = pattern.matcher(response); if (matcher.find()) { ArrayList<XModel> xModels = new ArrayList<>(); putModel(matcher.group(1),"Normal",xModels); onTaskCompleted.onTaskCompleted(xModels,false); }else onTaskCompleted.onError(); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #13
Source File: FEmbed.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ String id = get_fEmbed_video_ID(url); if (id!=null){ AndroidNetworking.post("https://www.fembed.com/api/source/"+id) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parse(response); if (xModels!=null){ onComplete.onTaskCompleted(sortMe(xModels),true); }else onComplete.onError(); } @Override public void onError(ANError anError) { onComplete.onError(); } }); }else onComplete.onError(); }
Example #14
Source File: StreamTape.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels.isEmpty()){ onTaskCompleted.onError(); }else onTaskCompleted.onTaskCompleted(xModels, false); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #15
Source File: TW.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ AndroidNetworking.post("https://twdown.net/download.php") .addBodyParameter("URL", url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { onComplete.onTaskCompleted(sortMe(Twitter.fetch(response)),true); } @Override public void onError(ANError anError) { onComplete.onError(); } }); }
Example #16
Source File: SolidFiles.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ AndroidNetworking.get(url) .addHeaders("User-Agent","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Safari/537.36") .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parse(response); if (xModels!=null){ onComplete.onTaskCompleted(xModels,false); }else onComplete.onError(); } @Override public void onError(ANError anError) { onComplete.onError(); } }); }
Example #17
Source File: GoUnlimited.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ AndroidNetworking.get(url) .setUserAgent(agent) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parse(response); if (xModels!=null){ onComplete.onTaskCompleted(xModels,false); }else onComplete.onError(); } @Override public void onError(ANError anError) { onComplete.onError(); } }); }
Example #18
Source File: MP4Upload.java From xGetter with Apache License 2.0 | 5 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(fixURL(url)) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parseVideo(response); if (xModels==null){ onTaskCompleted.onError(); }else onTaskCompleted.onTaskCompleted(xModels, false); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #19
Source File: VivoSX.java From xGetter with Apache License 2.0 | 4 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.get(url) .addHeaders("User-Agent","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Safari/537.36") .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { String encString = getEncrypt(response); if (encString!=null){ ArrayList<XModel> xModels = new ArrayList<>(); String src = decode(encString); if (src!=null) { XModel xModel = new XModel(); xModel.setUrl(src); xModel.setQuality("Normal"); xModels.add(xModel); onTaskCompleted.onTaskCompleted(xModels,false); }else onTaskCompleted.onError(); }else onTaskCompleted.onError(); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #20
Source File: ApiHelper.java From Android-MVP-Sample-Application with Apache License 2.0 | 4 votes |
public void getData(StringRequestListener listener) { AndroidNetworking.get(ApiEndPoint.GET_DATA) .addPathParameter("pageNumber", "0") .addQueryParameter("limit", "3") .build() .getAsString(listener); }
Example #21
Source File: BridgeUpdateService.java From Android-Bridge-App with MIT License | 4 votes |
@Override public void run() { AndroidNetworking.post(VERSION_CHECK_URL).build().getAsString(new StringRequestListener() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); if (jsonObject != null) { String versionName = getApplicationContext().getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0).versionName; if (versionName != null) { if (Utils.compareVersionNames(versionName, jsonObject.getString("version")) == -1) { Runtime.getRuntime().exec("dpm set-device-owner com.dji.wsbridge/.DeviceAdminRcvr"); updateApp(); } } } } catch (Exception e) { e.printStackTrace(); } } @Override public void onError(ANError anError) { Log.d("BridgeUpdateService", "error " + anError.getErrorCode() + anError.getErrorDetail()); } }); }
Example #22
Source File: MyApplication.java From Android-MVP-Sample-Application with Apache License 2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); AndroidNetworking.initialize(getApplicationContext()); mApplicationComponent = DaggerApplicationComponent.builder() .applicationModule(new ApplicationModule(this)) .build(); mApplicationComponent.inject(this); }
Example #23
Source File: BaseActivity.java From EasyVPN-Free with GNU General Public License v3.0 | 4 votes |
protected void getIpInfo(final List<Server> serverList) { JSONArray jsonArray = new JSONArray(); for (Server server : serverList) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("query", server.getIp()); jsonObject.put("lang", Locale.getDefault().getLanguage()); jsonArray.put(jsonObject); } catch (JSONException e) { e.printStackTrace(); } } AndroidNetworking.post(getString(R.string.url_check_ip_batch)) .addJSONArrayBody(jsonArray) .setTag("getIpInfo") .setPriority(Priority.MEDIUM) .build() .getAsJSONArray(new JSONArrayRequestListener() { @Override public void onResponse(JSONArray response) { if (dbHelper.setIpInfo(response, serverList)) ipInfoResult(); } @Override public void onError(ANError error) { } }); }
Example #24
Source File: FB.java From xGetter with Apache License 2.0 | 4 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ AndroidNetworking.post("https://fbdown.net/download.php") .addBodyParameter("URLz", "https://www.facebook.com/video.php?v="+ url) .addHeaders("User-agent", agent) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = new ArrayList<>(); String sd = getFbLink(response, false); if (sd!=null){ putModel(sd,"SD",xModels); } String hd = getFbLink(response, true); if (hd!=null) { putModel(hd, "HD", xModels); } if (xModels.isEmpty()){ onTaskCompleted.onError(); }else onTaskCompleted.onTaskCompleted(xModels,true); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }
Example #25
Source File: MainActivity.java From xGetter with Apache License 2.0 | 4 votes |
private void parseMe() { AndroidNetworking.initialize(this); AndroidNetworking.get("https://www.youtube.com/get_video_info?video_id=bOh9a2euDEM&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FbOh9a2euDEM") .setUserAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Safari/537.36") .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { System.out.println("onResponse: "+response); } @Override public void onError(ANError anError) { System.out.println("onError: "+anError.getErrorDetail()); } }); }
Example #26
Source File: Vidoza.java From xGetter with Apache License 2.0 | 4 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onTaskCompleted){ url = fixURL(url); if (url!=null) { AndroidNetworking.get(url) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { ArrayList<XModel> xModels = parse(response); if (xModels!=null) { onTaskCompleted.onTaskCompleted(xModels, false); }else onTaskCompleted.onError(); } @Override public void onError(ANError anError) { onTaskCompleted.onError(); } }); }else onTaskCompleted.onError(); }
Example #27
Source File: MyApplication.java From API-Calling-Flow with Apache License 2.0 | 3 votes |
@Override public void onCreate() { super.onCreate(); AndroidNetworking.initialize(getApplicationContext()); }
Example #28
Source File: MainActivity.java From API-Calling-Flow with Apache License 2.0 | 3 votes |
private void requestTestApi() { //TODO Step 1: Get reference to root layout of Activity or Fragment. RelativeLayout parentLayout = (RelativeLayout) findViewById(R.id.relativeLayout); /* * TODO Step 2: Initialize ApiCallingFlow * 1st parameter - context * 2nd parameter - parentLayout from step 1 * 3rd parameter - isTransparent (if you want background color to be transparent then 'true' else for default white background 'false') */ final ApiCallingFlow apiCallingFlow = new ApiCallingFlow(this, parentLayout, false) { @Override public void callCurrentApiHere() { //TODO Step 3: Pass function to call current API requestTestApi(); } }; //TODO Step 4: Get current Network state ( apiCallingFlow.getNetworkState() ) and request API accordingly. if (apiCallingFlow.getNetworkState()) { AndroidNetworking.get("https://jsonplaceholder.typicode.com/posts/1") .setPriority(Priority.HIGH) .setTag("requestTestApi") .build() .getAsJSONObject(new JSONObjectRequestListener() { @Override public void onResponse(JSONObject response) { new Handler().postDelayed(new Runnable() { @Override public void run() { ((TextView) findViewById(R.id.tvDummyView)).setText(getString(R.string.valid_text)); //TODO Step 5: Call ( apiCallingFlow.onSuccessResponse(); ) after API is successful apiCallingFlow.onSuccessResponse(); } }, 5000); } @Override public void onError(ANError anError) { new Handler().postDelayed(new Runnable() { @Override public void run() { //TODO Step 6: Call ( apiCallingFlow.onErrorResponse(); ) after API is failed apiCallingFlow.onErrorResponse(); } }, 5000); } }); } }
Example #29
Source File: LowCostVideo.java From xGetter with Apache License 2.0 | 3 votes |
public LowCostVideo(@NonNull Context context){ this.context=context; AndroidNetworking.initialize(context); }
Example #30
Source File: VK.java From xGetter with Apache License 2.0 | 3 votes |
public static void fetch(String url, final LowCostVideo.OnTaskCompleted onComplete){ AndroidNetworking.get(fixURL(url)) .addHeaders("User-agent", agent) .build() .getAsString(new StringRequestListener() { @Override public void onResponse(String response) { String json = get("al_video.php', ?(\\{.*])",response); json = get("\\}, ?(.*)",json); try { ArrayList<XModel> models = new ArrayList<>(); String x240="url240",x360="url360",x480="url480",x720="url720",x1080="url1080"; JSONObject object = new JSONArray(json).getJSONObject(4).getJSONObject("player").getJSONArray("params").getJSONObject(0); if (object.has(x240)){ putModel(object.getString(x240),"240p",models); } if (object.has(x360)){ putModel(object.getString(x360),"360p",models); } if (object.has(x480)){ putModel(object.getString(x480),"480p",models); } if (object.has(x720)){ putModel(object.getString(x720),"720p",models); } if (object.has(x1080)){ putModel(object.getString(x1080),"1080p",models); } onComplete.onTaskCompleted(sortMe(models),true); } catch (JSONException e) { e.printStackTrace(); onComplete.onError(); } } private String get(String regex,String html){ final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(html); if (matcher.find()) { return matcher.group(1); } return null; } @Override public void onError(ANError anError) { onComplete.onError(); } }); }