hide api call in android

  • Replies:5
  • Forum posts: 4

Feb 2, 2017, 7:38:31 AM via Website


I have to know how to hide my api call from source file in android.Is there any method for hiding api url in android.

  • Forum posts: 2

Feb 2, 2017, 10:14:05 AM via Website

There is no way to completely hide your API url in your source file.

But you can make it difficult to find from other users.
For that you can use NDK (Native Development Kit) and create C or C++ library in it. And add your API url in seperated string like this

For example your API url is : www.mysite.com/api/v2/register.php
Then you can make it like this

#define one "site"
#define two  "web"
#define three  "www."
#define four "my"
#define five ".com/"
#define six ".orhg/"
#define seven "api/v1/"
#define eight "api/v3/"
#define nine "api/v2/"
#define ten "user_master.php"
#define eleven "register_master.php"
#define twelve "register.php"

 jstring YOUR FUNCTION NAME (JNIEnv *env, jclass thiz)
 char result[100];   // array to hold the result.


 return (*env) -> NewStringUTF(env, result);

now anyone can reverse your app and can get all the part of the API url but can't get the order you have given to create your URL.
That is strcpy cant be reversed . so they will not get the direct URL of your API.

I hope this will help you.


  • Forum posts: 4

Feb 11, 2017, 5:25:28 AM via Website

You can hide URL link or any String-constant in your source code by using the feature "Hide String" in the solution: Bg+ Anti Decompiler (JAVA)].
example: "abc.edf.com" -> ¢æÞ(2121);

This app is free on Google store, you can find it easily (I'm a new guy, so I can't write address link - play.google.com/store/apps/details?id=com.bgplus.Anti.JavaDecompiler)


  • Forum posts: 1

Jun 26, 2020, 9:19:29 PM via Website

Good solution ! but keep in mind URL still can be captured using http capture app like "Packet Capture"