Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set "installer" package value as returned in getInstallerPackageName()

I have an Android app that uses a WebView to enable users to install applications. Historically, applications installed from Android Market will have the installer value set to "com.google.android.feedback". With Google Play, this value is now "com.android.vending".

This value can be obtained by:

PackageManager pm = context.getPackageManager();
String installer = pm.getInstallerPackageName(pname);

The apps installed by my WebView have an installer value set to null. How can I set my own installer value, such as com.mydomain.store?

like image 264
Rami Avatar asked Feb 05 '12 04:02

Rami


2 Answers

While this doesn't strictly answer the question to do this programmatically, it's also possible to set the vendor package through adb without needing it to be signed with the same key.

There's a complete explanation here, but it boils down to:

The following adb trick sets the install vendor of a debug app:

adb push app.apk /sdcard/app.apk
adb shell pm install -i "com.android.vending" -r /sdcard/app.apk
adb shell rm /sdcard/app.apk

To confirm that this has worked, list the packages using the Package Manager:

adb shell pm list packages -i [packagename]

If all has gone well, you should see this output:

package:[packagename]  installer=com.android.vending
like image 105
Paul Lammertsma Avatar answered Oct 07 '22 01:10

Paul Lammertsma


You could try using setInstallerPackageName.

But you would have to set the installer package name after the package is installed, and the installer package name would have to be empty/null.

like image 21
Reed Avatar answered Oct 06 '22 23:10

Reed