Check if an app is installed on the device

I'm trying to use the package name and determine the apk path of an app to check if my app is installed in the device.

pathCmd = './adb shell pm path ' + packageName

pathData = os.popen(pathCmd,"r")

for pathInfo in pathData:

print pathInfo

if not pathInfo:

else:
print "App found on the device"


This doesn't give me the list of apps that are not installed. Any idea whats wrong with my script?

• Before people vote to close, this doesn't seem to be a clear-cut development question. While it's true that he is developing a script, it's also an ADB question. It's essentially something you could do in bash or in a Windows batch. I'll let the community decide if this is off-topic or not. – dotVezz Dec 23 '13 at 23:59
• Consider to accept your own answer if there is no other answer, and if it solved your problem, thanks. – Andrew T. Apr 27 '15 at 5:40

pathCmd = './adb shell pm path ' + packageName