-5

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?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
ShWaEkI
  • 1
  • 1
  • 5

2 Answers2

0

Use Authentication so no one can access your links without a password.

Yamen Nassif
  • 2,416
  • 2
  • 24
  • 48
0

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.

magicleon94
  • 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
  • well when doing reverse engineering you will not see the file? – ShWaEkI Sep 21 '17 at 11:19
  • 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
  • do not just links :D – ShWaEkI 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
  • did you try to decompiling apk because this is not working – karan May 03 '23 at 05:53