Search code examples
androidandroid-implicit-intent

Unable to launch kakao talk from implicit intent


Im willing to open KakaoTalk using implicit intent. Following is my code.

PackageManager pm = getActivity().getPackageManager();
        try {

            Intent waIntent = new Intent(Intent.ACTION_SEND);
            waIntent.setType("text/plain");
            String text = "";

            PackageInfo info = pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);
            waIntent.setPackage("com.kakaotalk");

            waIntent.putExtra(Intent.EXTRA_TEXT, text);
            startActivity(Intent.createChooser(waIntent, "Share with"));

        } catch (PackageManager.NameNotFoundException e) {
            Toast.makeText(getActivity(),"kakao talk not Installed", Toast.LENGTH_SHORT).show();
        }

even though kakao talk is installed in my mobile , it says that kakao talk is not installed. How can I sort this out?


Solution

  • You are catching PackageManager.NameNotFoundException. That could be thrown by pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);. There, you are asking for com.whatsapp. Presumably, this is not the application ID of the app that you are seeking.