-1

Creating an android app to receive data in json format from web server
in my app I should have url as string and use it to fetch data like below

private static final String my_url = "http://example.com/folder/showJsonData.php";
jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, my_url ,new Response.Listener<JSONObject>() {
.
.
.
}


as you see my_url is not complicated or encoded so everyone can access it after decompiling apk.
the question is that how can I make it a little more complicated
please explain it with example.
Thanks

unknown
  • 29
  • 1
  • 7
  • 1
    Possible duplicate of [hiding strings in Obfuscated code](http://stackoverflow.com/questions/4427238/hiding-strings-in-obfuscated-code) – K Neeraj Lal Sep 16 '16 at 10:48

1 Answers1

0

URL encoding is done in the same way on android as in Java SE;

try {
    String url = "http://www.example.com/?id=123&art=abc";
    String encodedurl = URLEncoder.encode(url,"UTF-8");
    Log.d("TEST", encodedurl);
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
} 
Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60