Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing an android app being cloned by an app cloner

Tags:

android

Created an app that used the device's uniqueID which is fetched by the following code snippet

String deviceId = Settings.Secure.getString(getContentResolver(),
            Settings.Secure.ANDROID_ID);

When the user tries to clone the app by app cloner, then it creates a different deviceID and the app is not allowed to work

Is there any way to make our app non clonable or

Any possible way to have the same deviceId even if the app instance is cloned?

Is there any way to find out whether the app is running in a cloned instance?

like image 321
ABI Avatar asked Feb 21 '18 07:02

ABI


People also ask

How do you stop an app from cloning?

Any possible way to have the same deviceId even if the app instance is cloned? Is there any way to find out whether the app is running in a cloned instance? there is no way to completely prevent cloning. Hackers will always find a way.

How do I stop my Android from cloning apps?

My Suggestion - For that what we can do, is to check the fileDir() of our application whenever the apps runs and if it differ from the original one then stop the application. Below you can see all the different file paths we have. You can use something like this to check the app cloning.

What happens when an app is cloned?

When you clone an app, you're creating an identical copy that can be used independently. That means you can sign in with one account on one version and a different account on another. Even if the app does support multiple accounts, you may find it easier to switch between them this way.

Is it legal to clone an app?

Website or App cloning is absolutely legal unless you are breaching their IPs, copyright, patents or trade marks of existing businesses. The word 'clone' or 'app cloning' might convey wrong impression about the process.


1 Answers

I found a story in proandroiddev by Siddhant Panhalkar and with some minor changes it's work perfectly in Mi device I did checked in Mi phones default Dual apps and some third party apps from playstore and it prevents from cloning (means not working properly after clone).

private const val APP_PACKAGE_DOT_COUNT = 3 // number of dots present in package name
private const val DUAL_APP_ID_999 = "999"
private const val DOT = '.'

fun CheckAppCloning(activity: Activity) {
    val path: String = activity.filesDir.getPath()
    if (path.contains(DUAL_APP_ID_999)) {
        killProcess(activity)
    } else {
        val count: Int = getDotCount(path)
        if (count > APP_PACKAGE_DOT_COUNT) {
            killProcess(activity)
        }
    }
}
private fun getDotCount(path: String): Int {
    var count = 0
    for (element in path) {
        if (count > APP_PACKAGE_DOT_COUNT) {
            break
        }
        if (element == DOT) {
            count++
        }
    }
    return count
}

private fun killProcess(context: Activity) {
    context.finish()
    android.os.Process.killProcess( android.os.Process.myPid())
}
like image 189
Bhavin Patel Avatar answered Nov 15 '22 19:11

Bhavin Patel