Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PiracyChecker fails to check whether the app is installed from Google Play Store

I'm using 'com.github.javiersantos:PiracyChecker:1.2.3' because my app is not yet integrates AndroidX.

I have numerous reports from user reviews in my app's Google Play page that they have installed the app from the Google Play Store, yet they getting the piracy warning message.

Here are some examples:

enter image description here

Also got a user report via email:

enter image description here

My app have 4k reviews and only 3 of them are like this, but I don't know the exact user count because there could be users who don't comment about this issue.

What is going on?

I use it like this:

    public static void showPiracyActivityIfNeeded(final Activity activity) {
    if (!BuildConfig.DEBUG) {
        //Releaseb build, piracy check.
        new PiracyChecker(activity)
                .enableInstallerId(InstallerID.GOOGLE_PLAY)
                .callback(new PiracyCheckerCallback() {
                    @Override
                    public void allow() {
                    }

                    @Override
                    public void dontAllow(@NonNull PiracyCheckerError piracyCheckerError, @Nullable PirateApp pirateApp) {
                        Intent intent = new Intent(activity, PiracyWarningActivity.class);
                        activity.startActivity(intent);
                        activity.finish();
                    }
                })
                .start();
    }
}

Thanks in advance.

like image 436
Adam Varhegyi Avatar asked Nov 22 '19 11:11

Adam Varhegyi


1 Answers

It seems that your Google Play Services are unavailable. Try to check it before start your PiracyActivity:

const val PLAY_SERVICES_RESOLUTION_REQUEST = 9000

fun AppCompatActivity.checkPlayServices(): Boolean {
    val apiAvailability = GoogleApiAvailability.getInstance()
    val resultCode = apiAvailability.isGooglePlayServicesAvailable(this)
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
                .show()
        }
        return false
    }
    return true
}

And then:

public static void showPiracyActivityIfNeeded(final Activity activity) {
    if (!BuildConfig.DEBUG && activity.checkPlayServices()) { ...

Also note, there are a lot of devices that has Google Play Services turned off because of various reasons, so check availability of Services every time you need it.

like image 173
anil Avatar answered Nov 19 '22 18:11

anil