1

I check capability via PackageManager

final PackageManager packageManager = context.getPackageManager();
        final Intent intent = new Intent(Intent.ACTION_CALL);
        List<ResolveInfo> list =
                packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        return list.size() > 0;

But anyway result is false. Application was on tablet and phone, but result is the same. Where I was wrong?

Danila
  • 111
  • 6

1 Answers1

4

You should try this:

PackageManager pm = this.getPackageManager();

 if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
     System.out.println("horray");
 } else {
     System.out.println("nope");
 }

Edit: To check Skype is installed in device or not?

Pass Skype URI in following method.

private boolean appInstalledOrNot(String uri) {
        PackageManager pm = getPackageManager();
        boolean app_installed = false;
        try {
            pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
            app_installed = true;
        }
        catch (PackageManager.NameNotFoundException e) {
            app_installed = false;
        }
        return app_installed ;
    }
The Holy Coder
  • 6,374
  • 8
  • 36
  • 71
  • It works except situation, when I run app on tablet, but there isn't telephony feature in system, but I can make call via skype. – Danila Aug 04 '14 at 09:45
  • You can check `Skype` is installed in device or not. – The Holy Coder Aug 04 '14 at 09:47
  • Yes, of course, but it isn't rationally to check every app, which can make call. If I have such applications in system, by default I can use them by starting next intent (new Intent(Intent.ACTION_CALL, Uri.parse(number)); ). And I just need to know if such apps installed in system or not. – Danila Aug 04 '14 at 09:52
  • Programmatically check permission which apps have calling permission listed in their manifest. – The Holy Coder Aug 04 '14 at 09:56
  • That's what I need. But how I can do this? – Danila Aug 04 '14 at 09:59
  • Decision about permission wasn't right, because even if CALL_PHONE permission is in app manifest, it doesn't mean that we can make call via this app. Thank's for your help, I'll try another way to solve this problem. – Danila Aug 04 '14 at 10:19