-1

Possible Duplicate:
Android - check for presence of another app

How to check if an application is installed on the smartphone? For my application, I need to know if Facebook and Twitter are installed on the smartphone.To see if I can use them.

Community
  • 1
  • 1
Setsuna
  • 207
  • 1
  • 3
  • 11
  • http://stackoverflow.com/questions/3694267/android-check-for-presence-of-another-app?rq=1 you have to run search here first – Sergey Benner Aug 06 '12 at 13:09
  • http://stackoverflow.com/questions/2878694/determining-if-an-activity-exists-on-the-current-device. The queryIntentActivities() solution is the best option – CSmith Aug 06 '12 at 13:12
  • 2
    Unless in rare cases you should not test for specific applications and use them explicitely but call intents that those application can process. E.g. you should only share content via an intent so any application that can handle this intent (like Facebook, Twitter, Tumblr, Pinterest, Mail, SMS, Dropbox...) can be used. – Hauke Ingmar Schmidt Aug 06 '12 at 13:13
  • Just sorry,it seems I was searching with a bad keyword , sorry for this repeat post, if it could be deleted, it would be nice. Thank you even when your answer. – Setsuna Aug 06 '12 at 13:54

1 Answers1

1

Use this

PackageManager pm = getPackageManager();
boolean s = false;
try{ 
     pm.getPackageInfo("app package",0); 
     s = true; 
} catch (Exception e ) { s= false; }

you can find app package on google play site (in page url)

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
Alex Klimashevsky
  • 2,457
  • 3
  • 26
  • 58