android系统下的广播: 电池电量低、电池充电完成、短信到来了、程序安装卸载、sd卡卸载安装 等

BrocastReceiverDemo.java

public class BrocastReceiverDemo extends BroadcastReceiver{

	@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
//getResultData() 获取数据
String phoneNum=getResultData();
System.out.println("打电话了:"+phoneNum); } }

在Manifest.xml中<application>下要注册

<receiver android:name="com.example.brocastreceiverdemo.BrocastReceiverDemo">
<intent-filter>
<!-- 要监听的意图 -->
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
05-08 15:12