I used the url link in my application to send and receive data from the server. If some body decompiles my apk file and the source can use the URL and send spam or make purchases without payment!
now how can i protect urls?
This is an example of a server request that I used. (so far I am using the local server until the application is completed)
public class GetProduct {
ArrayList<Product> arrayList;
ProgressDialog progressDialog;
String url = "http://192.168.43.46/fasabazar/android/getProductsFullInfo";
OnProductRecieved onProductRecieved = null;
public GetProduct(final OnProductRecieved onProductRecieved, final Context context) {
arrayList = new ArrayList<>();
progressDialog = new ProgressDialog(context);
this.onProductRecieved = onProductRecieved;
JsonArrayRequest request = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
JSONArray jsonArray = (JSONArray) response;
progressDialog.dismiss();
onProductRecieved.OnRecieved(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
progressDialog.show();
request.setRetryPolicy(new DefaultRetryPolicy(7000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
RequestQueue requestQueue = Volley.newRequestQueue(context);
requestQueue.add(request);
}
public interface OnProductRecieved {
void OnRecieved(JSONArray response);
}
}
source
share