-
Notifications
You must be signed in to change notification settings - Fork 13
Enable / disable 'receive incoming calls' #4
Comments
The Android API unfortunately doesn't support this at the moment. |
Bummer. Thx for the reply!
|
Seems to be possible now? There seems to be a setter method for that: |
This class has been there for some time, but it's part of the phone app and thus cannot be called from an outside app. |
Just tried it with SDK 22, it worked for me: Settings.System.putInt(getApplicationContext().getContentResolver(), "sip_receive_calls", 1); |
The last time I tried this, only the settings dialog reflected the change. The behavior of the phone was unaffected, i.e. incoming SIP calls would not be received. |
Ah, OK. I didnt test, if it really works :), just, as you said, that the settings checkbox changed the state. |
Ok, tested. :-P I could see the changed settings immediately with: Settings.System.getInt(getApplicationContext().getContentResolver(), "sip_receive_calls"); But I had to send the notify broadcast com.android.phone.SIP_CALL_OPTION_CHANGED, like you do, otherwise it wont worked for me. If I set it to 0, there was no delay, I didn't receive calls anymore. But if I set to 1, the call is only incoming after a period of time. For me it was 30-60 seconds. I think this has something to do with the sip registration. Perhaps you can force an registration, theres a method for that, but I couldn't find out yet, how to parse through the already defined profiles to get the profile uris. Tested with CM12 nightly. SIP Provider is Telekom Germany. EDIT: Perhaps you can get the profiles with the SipSession.Listener |
I actually tried this some time ago, but maybe I was too impatient. I think this should be investigated further. |
I do really need this, therefore I wrote a small app which works for me very well since months (but requires "root"): |
See my MR #16 which should triage this |
Just for reference if someone arrives here googling around, like I did: it seems to me that at a certain point the API was changed. At least on Android 11 (Evolution-X on Poco X3, specifically) the intent to broadcast is now "android.net.sip.action.SIP_CALL_OPTION_CHANGED" . |
More a feature request.
Would be great if the widget had an easy one click button to enable / disable 'receive incoming calls'. IMHO the 'settings shortcut' button could be used for that.
The text was updated successfully, but these errors were encountered: