2016-05-31 7 views
3

Playストアからダウンロードされ、他のユーザーや他のソースから共有されていない場合にのみ、アプリの使用を確認して許可します。 Google Playストアからダウンロードされていない場合、ユーザーがアプリを使用しないようにするにはどうすればよいですか?アプリがPlayストアからインストールされているかどうかを検出する

+0

[Googleプレイやサイドロードからアプリケーションがインストールされていることを知るにはどうすればよいですか?](http://stackoverflow.com/questions/10809438/how-to-know-an-application-is-installed- google-play-or-side-loadから) –

答えて

8

この方法では、アプリがPlayストアからインストールされているかどうかを確認します。

boolean verifyInstallerId(Context context) { 
    // A list with valid installers package name 
    List<String> validInstallers = new ArrayList<>(Arrays.asList("com.android.vending", "com.google.android.feedback")); 

    // The package name of the app that has installed your app 
    final String installer = context.getPackageManager().getInstallerPackageName(context.getPackageName()); 

    // true if your app has been downloaded from Play Store 
    return installer != null && validInstallers.contains(installer); 
} 

何日か前、私は、Googleがライセンス(LVL)、APKの署名を保護し、インストーラID(この1)を再生するなど、いくつかの技術を使用してアプリケーションを保護Androidのライブラリ、PiracyCheckerを、リリースしました。

関連する問題