I am working on an android that will allow the user to add numbers to a blacklist. When an incoming number matches a number in the blacklist then the call should be rejected, even if the phone does ring briefly and then disconnects the call.
Everything I’ve found including on SO, says it can’t be done without creating AIDL in com.android.internal.telephony which I’ve created but I can’t add the modify phone state permission as it says it needs to be a system app.
I am targetting ICS upwards and I have seen other apps block calls in ICS and up so how is this done. I’ve also tried adding the modify phone state permission to the manifest file and it displays an error saying that it is only available for system apps so how do I get around this issue. I don’t want the app to have to be rooted.
Thanks for any help you can provide
I’ve found the answer by a bit of luck.
Instead of adding permission
MODIFY_PHONE_STATEadd permissionCALL_PHONECreate a new package called
com.android.internal.telephonyInside this package create a file called
ITelephony.aidland add the following contentpackage com.android.internal.telephony;
Use the below code in order to block the call
Hope this helps others, its not too easy to find. I don’t understand why Google removed the ability to do this without mucking about like this though.