一、应用
对于电话拨号盘的过滤,AndroidManifest.xml配置文件中的Activity配置如下:
<activity
android:name=".IntentFilterAty"
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>
效果,点击电话按钮,弹出选择应用对话框,包含自己定义应用程序。
对于发送短信的过滤,AndroidManifest.xml配置文件中的Activity配置如下:
<activity
android:name=".IntentFilterAty"
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>
</activity>
在友录通讯录中点击发送短信按钮,弹出选择应用对话框,包含我们自定义应用程序。
程序调用短信发送功能,代码如下:
Intent sendIntent = new Intent(Intent.ACTION_SENDTO, Uri .parse("sms://"));
startActivity(sendIntent);