Inside a service I have:
// subscribe to incoming call notifications
registerReceiver(mIncomingCallReceiver, new IntentFilter("android.intent.action.PHONE_STATE"));
However onReceive never gets called:
// incoming call receiver
private BroadcastReceiver mIncomingCallReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
What's wrong here? I don't want to declare it through the manifest and additional class since it would require additional code to invoke corresponding method inside my service.
P.S. What I need to do is to stop the service player when an incoming call is registered.
Perhaps your manifest misses
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>