Reputation: 331
I would like to write software for my Android phone that intercepts incoming calls and plays a short audio clip instructing the caller to press "1" to proceed with the call. This is for fighting telemarketers.
Is this possible with the current (Android 7 "Nougat") API?
Notes:
It's hard to get a clear answer because in 2012, Android 2.3 (Gingerbread) removed some vital API related to modifying the phone state, see here. However, Android 7 ("Nougat") seems to support call-blocking (see here), so I'm hopeful that the current API supports intercepting calls.
I don't want to forward calls to some server as suggested here.
I would prefer to write the software myself, and not install an app like Hiya.
I have a regular phone number assigned by my carrier (no fancy Google Voice or VOIP stuff), and I use the standard "Phone" app.
My phone is not rooted.
This is inspired by the Jolly Roger Telephone Company anti-telemarketer bot.
I previously asked a similar question for iPhones here.
Thanks.
Upvotes: 2
Views: 3876
Reputation: 12121
The specific documentation link is Android 7.0 - Number Blocking feature
Android 7.0 now supports number blocking in the platform and provides a framework API to let service providers maintain a blocked-number list. The default SMS app, the default phone app, and carrier apps can read from and write to the blocked-number list. The list is not accessible to other apps.
The last line highlights that this isn't a general access feature.
Drilling down in to BlockedNumberContract
Only the system, the default SMS application, and the default phone app (See getDefaultDialerPackage()), and carrier apps (See CarrierService) can read, and write to the blockednumber provider. However, canCurrentUserBlockNumbers(Context) can be accessed by any application.
So if you are the default dialer or default SMS app you should have access. If you aren't either of those then all any app can do is find out if the feature is available.
Additionally I'm not aware of a general way to inject audio into a call, see: Call Stream Modification on Android
Upvotes: 2