hi I have an application running online and there are links in the server but the problem is that there are people who remove the application and take the links and implement them on the browser and become a problem within the application Is there a way to hide links?
-
Where are the links you want to hide? In the UI? In the code? Is the code public and you just need to hide them from the public code? – magicleon94 Sep 21 '17 at 10:06
-
example : Picasso.with(context).load("http://roman-android.com/" + View_stories.files + "/" + stories.images_view).into(holder.img_view); – ShWaEkI Sep 21 '17 at 10:12
-
I'm working on it. I know how to do it but I'm trying to remember a key step lol – magicleon94 Sep 21 '17 at 10:18
-
ok can you help me please :D – ShWaEkI Sep 21 '17 at 10:20
-
Done, hope it's clear enough! – magicleon94 Sep 21 '17 at 10:33
2 Answers
Use Authentication so no one can access your links without a password.

- 2,416
- 2
- 24
- 48
-
-
I have applications on the google play with a lot of users but there are people who are sabotaging I hope to find a solution – ShWaEkI Sep 21 '17 at 10:10
-
According to what you wrote in comments, suppose you have this:
Picasso.with(context).load("roman-android.com/" + View_stories.files + "/" + stories.images_view).into(holder.img_view);
You need to hide roman-android.com/
.
You can do this way:
Open your gradle.properties
file in your Android project. This file should be secret and not available online.
In gradle.properties
write your link:
mySecretLink="roman-android.com/"
Go to your build.gradle(module:app)
file and add, under android
, this:
buildTypes.each {
it.buildConfigField "String" , "MY_SECRET_LINK", mySecretLink
}
so that you'll have something like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
//blah blah stuff
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField "String" , "MY_SECRET_LINK", mySecretLink
}
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
//blah blah stuff
}
This will tell gradle to add your String
to the BuildConfig
class, that is generated on build time and completely external to your code.
Go to your code and just do this:
Picasso.with(context).load(BuildConfig.MY_SECRET_LINK + View_stories.files + "/" + stories.images_view).into(holder.img_view);
NOTE: I've tried to explain this and to adapt it in your situation. I based my explanation on an old code of mine where I did this to conceal my API key.
Obviously you need to keep secret the gradle.properties
file. You'll use its real values only at compilation time, keeping aliases for your secred information (such as MY_SECRET_LINK
) for the whole programming process.

- 4,887
- 2
- 24
- 53
-
In your android studio project. If you set the view mode to "android" (upper left corner of the project tab) it should be under "gradle" – magicleon94 Sep 21 '17 at 11:13
-
I found it :D , but anyone can open this file gradle.properties and see it – ShWaEkI Sep 21 '17 at 11:13
-
Well anyone on the machine you're building from. This method conceals the data if you're showing your code publicly. If someone has access to the whole project he could see the links, but that's for every stored string in your app... – magicleon94 Sep 21 '17 at 11:15
-
-
Yes you could, as for any app. I thought your problem was bound to concealing data from the code. If you need to protect your app from reverse engineering (although there's no 100% secure way) check this out: https://stackoverflow.com/q/13854425/3626078 – magicleon94 Sep 21 '17 at 11:26
-
I don't have experience in any of that but according to that, I suggest you to look up "ProGuard" from Google – magicleon94 Sep 21 '17 at 11:27
-
-
I said I have no experience in that. No offense but I cannot study that for you and write a tutorial :D – magicleon94 Sep 21 '17 at 11:29
-
but you said when writing his code in a file gradle.properties and reverse engineering work will show this file or not this is my only question :D – ShWaEkI Sep 21 '17 at 11:32
-
I don't know if the file itself will show or not... It could, or the value could be present in the decompiled code (where the value is used, inside the Picasso method). I don't have experience of reverse engineering so I don't know. All I can tell you is that my method will conceal the data from the source code, but I don't know how easy or hard it would be to recover the same value from a decompiled APK. – magicleon94 Sep 21 '17 at 11:47
-
If you asked for a way to conceal the links from the source code my answer can help. If you asked how to protect your links in any way including reverse engineering it's not, and I suggested you some stuff to look into for that, I can't do more because I have never faced this problem and I do not have experience in this as I do with just concealing from source code – magicleon94 Sep 21 '17 at 11:50
-