Search code examples
androidadb

google play referrer and localy installed app referrer


hi im trying to sideload an app meaning installing the app not from google play but from my apk. the app is on google play and is referred correctly when downloaded. however when im installing it on device there is no way to know that i referred it . i tried using $> pm install --originating-uri but it say permissons denied. what is the solution for referring a locally installed app ?

this is what adb says about pm install:

              pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]

              [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>]

              [--originating-uri <URI>] [--referrer <URI>] PATH

Solution

  • You will not be able to use the pm command with your application UID; you need to be root (0) or shell (2000). This may be why you are getting a permission denied error.

    I successfully set the installer package name with the following command:

    pm install -i com.test.installer -r filename.apk
    

    Tested to make sure Android accepted the installer name:

    adb shell su -c "grep com.test.installer /data/system/packages.xml"
    
    <package name="test.app" codePath="/data/app/test.app-1.apk" nativeLibraryPath="/data/app-lib/test.app-2" flags="572998" ft="14a75b0a2f0" it="14a6c2e5459" ut="14a75b0a584" version="1" userId="10215" installer="com.test.installer">