I used url link in my app to send and receive data from server. If some body decompile my apk file and get source can use url and send spam or do some buy without pay!
now how can I protect url links?
This is a sample of request to server that I used. (still I use local server until finish application)
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);
// Toast.makeText(context, jsonArray.toString(), Toast.LENGTH_SHORT).show();
}
}, 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);
}
}
You can't reliably protect those URL links. You may obfuscate your code, but there are tools to reverse obfuscation.
If someone wants to de-compile your code and de-obfuscate it, it's because they think you must have something valuable there to go after. In which case, your security approach is all wrong; It's your server or web service that is vulnerable, not just your App.
Sorry if this is not what you wanted to here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With