Android about no Activity found to handle intent problem

Source: Internet
Author: User

Android has two types of intent, explicit and implicit.


Explicit intent, that is, the recipient is specified when constructing the intent object;
Implicit intent, the sender of intent, when constructing intent objects,
Not knowing and not caring who the recipient is, it helps to reduce the coupling between the sender and the receiver.


For explicit intent,android There is no need to parse because the target component is already clear,
Implicit intent maps intent to an activity, intentreceiver, or service that can handle this intent by requiring Android parsing.


The intent parsing mechanism is primarily to find a matching intent by locating all intentfilter in the androidmanifest.xml and the intent defined therein.
In this parsing process, Android is judged by the three attributes of the action, type, and category of intent, judging by the following:
1 If the action is specified by intent, the action must be included in the Intentfilter action list of the target component, otherwise it will not match;


2 If the intent does not provide a type, the system will get the data type from it. As with action,
The data type list of the target component must contain the intent data type, otherwise it will not match.


3 If the data in intent is not a content: URI of type, and intent does not explicitly specify its type,
Matches are based on the scheme of the data in the intent (for example, http: or mailto:).
As above, the Intent scheme must be present in the scheme list of the target component.


4 If intent specifies one or more categories, they must all appear in the list of organized categories.
For example, the intent contains two categories: Launcher_category and Alternative_category,
The resolved target component must contain at least these two categories.




Each implicit intent that is emitted through the startactivity () method has at least one category, which is "Android.intent.category.DEFAULT",
So as long as the activity that wants to receive an implicit intent should include "Android.intent.category.DEFAULT" category, otherwise it will cause intent match to fail.


Example of a Intent-filter definition property setting:

<intent-filter >    <action android:name= "Com.netease.push.action.client.MESSAGE"/>    <action Android:name= "Com.netease.push.action.client.NEWID"/>    <action android:name= " Com.netease.push.action.client.METHOD "/>    <category android:name=" Android.intent.category.DEFAULT "/ ></intent-filter>



Android about no Activity found to handle intent problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.