Detect if app was downloaded from Android Market

前端 未结 5 1388
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 01:56

I have an Android library that uploads data to a test server and production server. I\'d like developers using this library to use the test server when developing, and produ

5条回答
  •  情话喂你
    2020-11-28 02:36

    Starting with API 5, you can use PackageManager.getInstallerPackageName(String). From the documentation:

    Retrieve the package name of the application that installed a package. This identifies which market the package came from.

    To get the package of the Android Market, this post may help.

提交回复
热议问题