How to Check If an Intent Can Be Handled from Some Activity

Use resolveActivity To Check if Intent Can Be Handled

You can add queries like this in your manifiest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.android">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<queries>
<package android:name="com.whatsapp" />

<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
</intent>
</queries>

<application
...
</application>
</manifest>

Check if intent is calling or Activity is started by default

Try checking if the result of getIntent() is null.



Related Topics



Leave a reply



Submit