Hi friends,
For Implicit intent, we dont need to declare the name of the class but we declare the action that we are doing to perform.
Like here we make a call
Uri callUri = Uri.parse("tel:100");
Intent intent = new Intent(Intent.ACTION_DIAL, callUri);
There might be a situation where If we call an intent there is no application to take it, then our app would crash.
So we need to check or verify the app that respond to that particular intent.
Here is the way to verify
PackageManager pManager = getPackageManager();
List nList = packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
boolean canInvoke = nList.size() > 0;
If canInvoke is true , Then There is atleast an app to handle this invoke, otherwise return false.
So hope you easily use this code and add one more verification in your application.
0 Comment(s)