0

Is it guaranteed that PackageManager.getInstallerPackageName() always returns a not null string?

PackageManager myapp= this.getPackageManager(); 
String installer = myapp.getInstallerPackageName("com.MyPackage");
if (installer == null) {
    // ...
}

We are considering this option vs Google licensing. But the application should operate in offline mode without network access.

cecan
  • 25
  • 8
  • maybe this link help you a little : http://stackoverflow.com/questions/12593621/getinstallerpackagename-returns-null – Arash Mar 07 '13 at 20:34
  • Yes, I check that question before, but is it 100%? – cecan Mar 07 '13 at 20:50
  • What other proof do you need? If you don't trust answers to that question, why would you trust answers here? The only way to be 100% sure is to test it yourself. – Anton Cherkashyn Mar 07 '13 at 23:28

2 Answers2

1

as far as i've read, this can be easily be spoofed, either using ADB (here) or by code (here) .

i didn't test any of them, but it seems this method doesn't have a good protection.

android developer
  • 114,585
  • 152
  • 739
  • 1,270
0

It is not necessary as if app is install from play store other then google play store getInstallerPackageName give installer of that store else if you innstall app via share from friend getInstallerPackageName give null

Ashish Garg
  • 162
  • 1
  • 11