[英]how to check whether an app is installed from my app if the app is not installed go to play store?
[英]PiracyChecker fails to check whether the app is installed from Google Play Store
我正在使用“ com.github.javiersantos:PiracyChecker:1.2.3 ”,因為我的應用程序尚未集成 AndroidX。
我的應用程序的 Google Play 頁面中有大量用戶評論報告說他們已經從 Google Play 商店安裝了該應用程序,但他們收到了盜版警告消息。
這里有些例子:
還通過 email 獲得了用戶報告:
我的應用有 4k 條評論,其中只有 3 條是這樣的,但我不知道確切的用戶數量,因為可能有用戶不評論這個問題。
到底是怎么回事?
我這樣使用它:
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();
}
}
提前致謝。
您的 Google Play 服務似乎不可用。 在開始您的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
}
接着:
public static void showPiracyActivityIfNeeded(final Activity activity) {
if (!BuildConfig.DEBUG && activity.checkPlayServices()) { ...
另請注意,有很多設備由於各種原因關閉了 Google Play 服務,因此請在每次需要時檢查服務的可用性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.