public class BroadcastTest extends Activity {
BroadcastReceiver receiver;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
receiver=new Receiver(this);
registerReceiver(receiver,new IntentFilter(Intent.ACTION_CALL_BUTTON));
}catch(Exception e){
Log.d("error",e.getMessage());
}
}
}
and another class
public class Receiver extends BroadcastReceiver{
public Receiver(BroadcastTest broadcastTest) {
// TODO Auto-generated constructor stub
}
@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
Log.d("Fired","Hi");
}
}
is onReceive method of receiver class supposed to be called when i press call button?if yes then it is not geting call.What i am doing wrong here.I am not seeing anything in logcat while pressing call button.Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…