How to start PhoneStateListener programmatically?
问题 There's an activity in my application. It contains a button. By clicking the button it should be start PhoneStateListener (and BroadcastReceiver?) to catch incoming and outgoing calls. It seems it should be a service. Does anyone can explain how to start PhoneStateListener (and BroadcastReceiver?) programmatically? 回答1: you have to used this code and it is 100% work. (1) you have to start services startService(new Intent(this, CallServices.class)); (2) you have to make CallServices class and