How to Fix Android Intent Filter Not Matching
In this tutorial, you'll learn about How to Fix Android Intent Filter Not Matching. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
The Problem
Your app declares an intent filter but the system does not list it as a handler:
No Activity found to handle Intent
Or a third-party app cannot launch your activity even though you declared the filter correctly.
The intent filter specification in the manifest is incomplete or conflicts with the sending intent.
Quick Fix
Step 1: Check the intent filter structure
<activity android:name=".ShareActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
Every intent filter must include <category Android:name="Android.intent.category.DEFAULT" /> for implicit intents.
Step 2: Verify the action matches exactly
// Sending app
val intent = Intent(Intent.ACTION_SEND).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, "Hello")
}
The action string must match: "Android.intent.action.SEND". A typo in either the filter or the sender breaks resolution.
Step 3: Set the MIME type correctly
The <data> element must match the intent's data type or URI scheme:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="www.example.com" />
</intent-filter>
For deep links, include both BROWSABLE and DEFAULT categories.
Step 4: Use only one data element per filter
Each <intent-filter> can declare multiple <data> elements, but they are treated as OR within the same filter. For different combinations, use separate filters:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
Step 5: Test the filter with ADB
adb shell am start -a android.intent.action.SEND -d "Hello" -t "text/plain"
If this fails, the filter is incorrect. The ADB output shows the exact error.
Prevention
- Always include
DEFAULTcategory in implicit intent filters. - Test intent filters with ADB before distributing the app.
- Use the manifest editor in Android Studio's visual designer for intent filter setup.
Common Mistakes with intent filter
- Using
returnto exit a function early instead of wrapping a pure value in the monad - Mixing let bindings with <- bindings in do notation, producing type errors
- Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
These mistakes appear frequently in real-world Android code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
DodaTech Tool Reference
Doda Browser's Deep Link Tester can verify intent filter resolution for custom schemes and universal links. Durga Antivirus Pro audits intent filters for security risks like exposed exported activities.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro