package com.example.broadcastreceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
//IP拨号器的广播接收者
public class Dialreceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
//获取电话号码
String number = getResultData();
// Log.e("TAG", "打电话了"+number);
//设置拨打电话号
setResultData("17951"+number);
}
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
//IP拨号器的广播接收者
public class Dialreceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
//获取电话号码
String number = getResultData();
// Log.e("TAG", "打电话了"+number);
//设置拨打电话号
setResultData("17951"+number);
}
}
package com.example.broadcastreceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
//监听SD卡挂在状态的广播接收者
public class SDCardStateReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("android.intent.action.MEDIA_MOUNTED".equals(action)) {
Log.e("TAG", "SDCard已安装");
}else if("android.intent.action.MEDIA_UNMOUNTED".equals(action)){
Log.e("TAG", "SDCard已卸载");
}
// Log.e("TAG", "SDCard被操作");
}
}