getInstallerPackageName returns null

后端 未结 3 543
长发绾君心
长发绾君心 2020-12-06 19:41

In my Android app I wanted to check the source of app installation. I looked at the Android documentation and found the following API as part of the PackageManager class:

3条回答
  •  醉话见心
    2020-12-06 20:22

    With regard to your question how was the app installed onto the device? Through "adb install" it will be null.

    Using the following you should be able to override it to whatever you want for testing purposes.

    pm install -i installername com.example.package
    

    GooglePlay should have a value of com.google.android.feedback. I'm not sure what values other app stores use.

提交回复
热议问题