Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneStateListener onMessageWaitingIndicatorChanged() not being called reliably

I have some code that detects when there is new voicemail. It's based on a PhoneStateListener.onMessageWaitingIndicatorChanged() implementation (so technically it fires only when the MWI indicator changes, not necessarily for every new voicemail).

It has been working perfectly for many months until 4.x.x updates to the devices.

Now, this works when the device is rebooted, otherwise its very unreliable. I can see the voicemail icon appear in the notification bar, but the debug logs in onMWIChanged stay silent.

I know that with 4.x.x there is a voicemail provider API. Thinking that this may have a connection, I added the android.intent.action.NEW_VOICEMAIL and android.intent.action.PROVIDER_CHANGED intents to my receiver, but they don't fire (in my BroadcastReceiver onReceive) either (my app's minSdkVersion is 8).

like image 867
PVS Avatar asked Mar 21 '13 14:03

PVS


1 Answers

This is a post from Android Developers about the Android 4.0 APIs.

http://developer.android.com/about/versions/android-4.0.html

If you scroll down there is a section about Voicemail Providers where it explains:

Because the APIs currently do not allow third-party apps to read all the voicemails from the system, the only third-party apps that should use the voicemail APIs are those that have voicemail to deliver to the user.

However, I assume if you are trying to receive voicemails from a third party and not from your service then this still may be possible. Check out this link about VoicemailContracts where I believe it says you need the permission ADD_VOICEMAIL in your manifest to use the actions you are using above.

http://developer.android.com/reference/android/provider/VoicemailContract.html

There are also samples that I did not get a chance to look at called Voicemail Provider Demo in your SDK. I hope this helps.

like image 65
rhite1 Avatar answered Sep 25 '22 20:09

rhite1