I am trying to create Phone state changed listener inside service. My service extends basic Service so no IntentService or anything like that.
Receiver is basic BroadcastReceiver which I register like this:
IntentFilter filter = new IntentFilter();
filter.addAction(TelephoneManager.ACTION_PHONE_STATE_CHANGED);
registerReceiver(receiver, filter);
However my receiver onReceive is never called. What am I missing? If I change filter action to Intent.ACTION_SCREEN_OFF for example, I am getting onReceive every time I turn screen off so I think that there is maybe some problem in my IntentFilter. I want to use this to listen for incoming calls, signal strength, cell id change and all that stuff. I have registered READ_PHONE_STATE permission in manifest so this should not be a problem. My device is Nexus 5X with Android 6.0.1
Any ideas?