Android Question Intercept phone events in background

Slacker

Active Member
Licensed User
Hello folks, the question is simple ( i guess... ) :D

Is it possibile to intercept ( and handle ) an sms message and incoming calls in background ( choosing in advance if send standard system notify or suppressing it completely ) by using PhoneEvents inside a Service ( registering it in manifest as Static Receiver ) ? If not, what it could be the best to achieve this result ( some piece of a minimal code could be useful please ) ?

Thank you ! :)
 
Last edited:

Erel

Administrator
Staff member
Licensed User
It is possible to intercept SMS messages and calls with static receivers: Intent Filters - Intercepting SMS messages in the background
It is not possible to abort the intents. Note that starting from Android 4.4 it is not possible to abort SMS messages.

In order to use PhoneEvents in the background you need to make sure that the process is running all the time. This can be done with a foreground service.
 
Upvote 0

Slacker

Active Member
Licensed User
It is possible to intercept SMS messages and calls with static receivers: Intent Filters - Intercepting SMS messages in the background
It is not possible to abort the intents. Note that starting from Android 4.4 it is not possible to abort SMS messages.

In order to use PhoneEvents in the background you need to make sure that the process is running all the time. This can be done with a foreground service.

What do you mean it's not possible to abort SMS Message ? I hope is possible to get the intent and handling it, to do not show any track about the sms received ( imaging i want silently delete a sms message.. is it possible i think... ) ?


Regards PhoneEvents you mean i cannot use it as setting a Service as Static Receiver ( Handling the manifest in following way ) ?

B4X:
AddReceiverText(Listener,
<intent-filter>   
    <action android:name="android.intent.action.PHONE_STATE" />
    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>)
 
Upvote 0

DonManfred

Expert
Licensed User
As far as i know starting from android 4.4 only ONE messanging-app can be the default one to handle SMS. And only this app can remove SMSs.
 
Upvote 0

Slacker

Active Member
Licensed User
Thank you Don. I need to intercept ( further the phone calls ) the sms messages and, based on the user settings in my app, remove them silently if they are from unwanted sender. I need also to remove them from the default Android system database leaving any track about it/them.

If this task cannot be accomplish in Android 4.4, this is pretty shitty restriction :p

I hope someone could give more precise informations it about, please.
 
Upvote 0
Top