我在我的应用程序中使用URL链接来从服务器发送和接收数据。如果有人反编译我的APK文件并获得源代码,可以使用URL链接发送垃圾邮件或不付款购买商品!
现在我该如何保护URL链接?
这是我使用的向服务器发送请求的示例(仍然在使用本地服务器,直到完成应用程序)。
现在我该如何保护URL链接?
这是我使用的向服务器发送请求的示例(仍然在使用本地服务器,直到完成应用程序)。
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);
}
}