1

The Sky Go application will not work for me because it thinks my Samsung Galaxy Nexus is rooted even though I have never rooted it.

According to the Sky customer service agent I chatted to, this can be because of apps on the phone which weren't installed from the Android Market/Google Play.

I know that I have manually installed an apk or two in the past[1], but I am not sure which apps still on the phone (if any) were installed manually.

So, how can I tell which apps on phone were installed manually and which were installed from the Android Market/Google Play?

[1] Amusingly, the only app I can remember installing manually was the Sky Go app, when it wasn't available to download for Galaxy Nexus phones. It didn't work however, and I removed it.

2
  • 2
    You should ask Sky support how installing an app from an "unknown source" (eg not Play Store) means that your phone is rooted - that's not an indicator of root. Those apps don't have root permission either.
    – A--C
    Jan 20, 2013 at 23:13
  • @A--C Yeah, I know but the person I was IMing with didn't seem to be up for answering issues like that. I presume Sky just have an extremely conservative policy on this because they cannot be sure that apps installed from other sources don't do things which their licences force them to protect against. Regardless of the sense of the policy. That's the way it is now, so that's what I have to deal with. Jan 22, 2013 at 12:27

3 Answers 3

2

The whole answer relies on the fact that when this query is made (requires ) :

adb shell pm list packages -3 -i

the installer for an app is listed in the output next to app's package name. We can filter the installer names in that output to single out apps not installed from Play Store.

Note: if you've a rooted Android OS, you may check /data/system/package.xml since the said command exposes the information found in that file, but in a more legible manner.

Automation

I found Tasker (user guide) apt as well as flexible for the job. Create a task named NonMarket and create the following actions inside it:

  1. Task → Run Shell

    • Command:

      pm list packages -3 -i | grep -ve "com.android.vending -ve "com.google.android.feedback"
      
    • Store Output In: %AllPkgs

    This will store the package name of all the third-party apps currently installed, but not from Play Store, in the variable AllPkgs. Replace -ve with -e in the said command if you intend to list apps currently installed and were installed from Play Store.

    Any line in that variable would be following this template:

    package:PACKAGE_NAME  installer=INSTALLER_NAME
    

    Here,

    • PACKAGE_NAME → package name of the app;
    • INSTALLER_NAME → package name of the installer app, such as com.android.vending or com.google.android.feedback for Play Store, org.fdroid.fdroid for F-Droid, null if installed manually by or from an ordinary file manager and so on.
  2. Variables → Variable Search Replace

    • Variable: %AllPkgs
    • Search: package:
    • tick Multi-Line
    • tick Replace Matches
    • Replace With: leave it untouched since we intend to remove the match from the lines
  3. Variables → Variable Search Replace

    • Variable: %AllPkgs
    • Search: .*

      Note that there is a whitespace before .* and it has to be included.
    • tick Multi-Line
    • tick Replace Matches
    • Replace With: leave it untouched since we intend to remove the match from the lines

    After the execution of this step, each line in the variable AllPkgs would contain only the package name of an app.

  4. Variables → Variable Set

    • Name: %ret
    • To: tap Enter key in your keyboard for once

    I learned this step from the post here by plepleus. This step is needed because we intend to copy each line (has a package name of an app) from AllPkgs into a separate variable. It is for ease of use.

  5. Variables → Variable Split

    • Name: %AllPkgs
    • Splitter: %ret

    This step makes an array of AllPkgs and each line of erstwhile AllPkgs is assigned to an index of that array. Hence, the size of the array is the number of lines AllPkgs had.

  6. Variables → Variable Set

    • Name: %count
    • To: 1

    We're creating a variable named count and initializing it to 1, for the purpose of looping on all the elements of AllPkgs.

  7. App → Test App

    • Type: Package Name
    • Data: %All(%count)
    • Store Result In: %Label(%count)

    This step finds an app's label from its package name and assign it to an element of array Label. See Variable Arrays in Tasker's userguide on Variables, if you're confused in this step.

  8. Variables → Variable Set

    • Name: %AllLabels
    • To: %Label(%count) - %AllPkgs(%count)%ret
    • tick Append

    The last step, on its every execution in any cycle of the loop, would overwrite the value assigned to the variable mentioned in Store Result In. This step would assign that value into a new variable named AllLabels and Append makes sure that new cycle only adds but doesn't overwrite previous changes.

    When the loop ends, AllLabels would be having lines where each of them would be having a particular app's label and package name.

  9. Variables → Variable Add

    • Name: %count
    • Value: 1

    This step increments Count variable, so that we can move to next cycle of loop.

  10. Task → Goto

    • Type: Action Number
    • Number: 7
    • If: %count < %AllPkgs(#)+1

    This step finally implements the loop. When this action is executed it checks whether count is less than the maximum number of elements in the array AllPkgs. If yes, it remains in the loop and creates a new cycle, else, the loop ends and we continue to rest of the actions below it.

  11. File → Write File

    • File: /sdcard/unknown_sources.txt
    • Text: %AllLabels

    This step writes all the lines stored in the variable AllLabels into a file named unknown_sources.txt under /sdcard. If you're making replacement in the first action, make sure to change the file name in this action to keep the results stored separately.

  12. Variables → Variable Clear → Name: %Label

    You would end up with bizarre outcomes if you don't clear an array manually created by user and uses it in a task.

  13. Alert → Flash → Text: Task completed.

Run the task using the play button. Once the task ends check the file to find the content you're seeking.


Command-line

I couldn't ignore command-line which makes the objective so easy to be achieved in this particular case.

Dependencies

  • Requires busybox tool. If you don't have it installed, refer to: How do I install missing command line tools onto an Android device?
  • Requires aapt tool. If you're running a CM or its derivative ROM then ignore this requirement. Otherwise, for Android 4.x, you can consider downloading the binary from here. For the purpose of installing it in device, follow the root or non-root approach mentioned here, appropriately.

    Android 5.x users: ask Google for assistance.

My little script

#!/system/bin/sh
# Check if the busybox binary exists under /data/local/tmp/ or /system/xbin. 
# Set the detected binary's path into the variable busybox or exit if file 
# doesn't exist or executable permission is not set
if [[ -x /data/local/tmp/busybox ]]; then 
    busybox=/data/local/tmp/busybox;
elif [[ -x /system/xbin/busybox ]]; then 
     busybox=/system/xbin/busybox;
else 
     date +'busybox binary not found or executable permission is not set. Exiting';
     exit;
fi

# Check if the aapt binary exists under /data/local/tmp or /system/bin or /system/xbin. 
# Set the detected binary's path into the variable aapt or exit if file
# doesn't exist or executable permission is not set
if [[ -x /data/local/tmp/aapt ]]; then 
    aapt=/data/local/tmp/aapt;
elif [[ -x /system/bin/aapt ]]; then
    aapt=/system/bin/aapt;
elif [[ -x /system/xbin/aapt ]]; then
     aapt=/system/xbin/aapt;
else  
     date +'aapt binary not found or executable permission is not set. Exiting';
     exit;
fi

# List third-party installed packages not installed from Play Store. Replace -ve with -e if you intend to list packages installed from Play Store.
pm list packages -3 -i | grep -ve "com.android.vending" -ve "com.google.android.feedback" | $busybox sed 's/package://g'| $busybox awk '{print$1}' > /sdcard/pkgs.txt
#$busybox printf "List of third-part installed apps not installed from Play Store:\n\n" 

# For each package, get its label and print it with package name on standard output
while read line; do
    path=$(pm path $line | $busybox sed 's/^package://g');          # retrieve path of package's APK. Required for finding app's label
    label=$($aapt d badging $path 2>&1 | $busybox sed -ne '/application: label=/p' | $busybox cut -d "'" -f2);   # Retrieve app's label using $path
    printf "$label - $line\n";  
done < /sdcard/pkgs.txt

Save the script under /sdcard into a file named nonplay.sh and run that file from a terminal emulator app in this manner:

sh /sdcard/nonplay.sh

Demo output:

(Click image to enlarge)

IMG:

(Note: those apps listed in the image were downloaded from Play Store some time ago in my Primary ROM. Since they were sideloaded in this secondary ROM, they appeared in the output. If I successfully update any of the sideloaded app from Play Store, it will be considered that the app is installed from Play Store.)

4
  • All of this can be avoided if you've root access. Titanium Backup allows filtering the apps based on "installer" ("linked"). I don't know a non-root alternative app however.
    – Firelord
    Feb 13, 2016 at 6:51
  • But shouldn't an application not be able to see the INSTALLER_NAME of another app without root access in the first place already?
    – SarpSTA
    Feb 13, 2016 at 8:35
  • @SarpSTA: Why do you think so? I see no harm if an app comes to know the name of the installer app.
    – Firelord
    Feb 13, 2016 at 9:03
  • Not harmful necessarily. Just wondering.
    – SarpSTA
    Feb 13, 2016 at 11:05
1

I find that the few apps I installed that were not from Google Play have their original apk in the Download folder. They usually ended there because I clicked an apk link through a website or blog I was viewing. After the download, the notification bar indicates the download is complete, and a click there starts the installer. I would start by looking into the folder

/storage/sdcard/Download

0

Short of going through your installed apps and checking them against your installed apps in google play im not sure what else you can do other than uninstall everything and re-add everything via google play

1
  • That's exactly the solution I was hoping to avoid :( It's not really worth the effort doing that just to decide whether or not I want to have Sky Go working. Jan 22, 2013 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .