To filter the telephone dials, the activity in the Mainfest configuration file is configured as follows:
<activity android:name= ". Testactivity "android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.CALL_BUTTON"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
effect, click the Phone button, pop up the Select App dialog box, including our own definition of the app:
When sending a text message, call the custom app:
<activity android:name= ". Testactivity "android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.SENDTO"/>
<data android:scheme= "Smsto"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
The effect is as follows, click the Send SMS button in the friend's address book, pop up the Select App dialog box, including our custom app:
The custom program calls the Send SMS function:
Intent sendintent = new Intent (Intent.action_sendto, Uri
. Parse ("sms://"));
StartActivity (sendintent);
Also, add Intent-filter to the Mainfest configuration file to increase the intent function for sending SMS messages:
<activity android:name= ". Testactivity "android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.SENDTO"/>
<data android:scheme= "SMS"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
The effect is as follows, click the button in your own program, call send SMS function:
Choose your own app and go to testactivity.
Intent filtering for HTTP requests:
<activity android:name= ". Testactivity "android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.VIEW"/>
<data android:scheme= "http"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
The effect is as follows, when you click on the HTTP connection, the dialog box for selecting the app pops up:
Filter share image function to achieve:
<activity android:name= ". Testactivity "android:label=" @string/app_name ">
<intent-filter>
<action android:name= "Android.intent.action.SEND"/>
<data android:mimetype= "image/*"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
This way, when you click the Share button in the photo album, the Share app selection dialog box pops up:
Android Intent-filter Simple usage