Android disable SMS service - android

Is there a way to programatically disable the user from receiving/sending sms messages?

No, you cannot do this. Maybe on rooted devices etc you could, but it's not standard situation to consider.

I don't know about sending part, but to block receiving sms you can give your app high priority
<receiver android:name=".receiver.SMSReceiver" android:enabled="true">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
and in your BroadcastReceiver's onReceive() method, you can use abortBroadcast(). So that received sms doesn't reach inbox.

Related

prevent other apps from sending broadcasts to my broadcastReceiver

I have a broadcastReceiver registered in manifest that receives broadcasts sent from one of my services with a custom action. I have it already working but for security reasons i want to prevent other apps from sending fake broadcast to my receiver. How can i do that?
Manifest
<receiver android:name=".MyReceiver">
<intent-filter>
<action android:name="MyAction"/>
</intent-filter>
</receiver>
Every reciever with exported tag set to false will only receive broadcasts sent from its own application process.
so it will be:
<receiver android:name=".MyReceiver"
android:exported="false">
<intent-filter>
<action android:name="MyAction"/>
</intent-filter>
</receiver>
As another solution i found that i can use permissions.
more on here

SMS static broadcastReceiver called twice Android Kitkat

I am implementing sms receive functionality in Android kitkat 4.4+. I am able to set my application as default successfully but when an sms is received broadcast receiver is called twice. I am unable to find the cause of this problem.
here is how I have declared my Broadcast reciever in manifest
<receiver
android:name="com.package.SmsRecieverKitkat"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BROADCAST_SMS" >
<intent-filter >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
</receiver>
when an sms is recieved broadcast reciever is called twice
That is because you are asking for both SMS_RECEIVED and SMS_DELIVER broadcasts. If you only want one of those, only listen for that one.

Stop SMS from moving to Inbox

Before Android 4.4 I was able to stop messages from moving to inbox by setting the priority like this
<receiver android:name="com.serviceschedular.helperClasses.SmsReceiver" >
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
and then abortBroadcast() in onRecieve() messages. However in Android 4.4 we need to define SMS_DELIVER_ACTION in order to make our messaging app as default :
Getting Your SMS Apps Ready for KitKat
By doing this I can receive messages first and they don't move to any other messaging app but I also need to send them to messaging app if it doesn't fill my criteria. So is there any way around to achieve this functionality?

How to hide unread SMS notification?

I'm writing application which handles SMS's and as I plan it should replace stock/default application.
I'm intercepting android.provider.Telephony.SMS_RECEIVED broadcast fired by incoming SMS and publishing my own notification and then calling abortBroadcast(), so in the end there is no notification for incoming new messages which leads to default/stock app.
But the problem is in fact that when user doesn't read for a long enough time (smth like several minutes) incoming SMS stock/default app aroses another broadcast - I suspect just checking that there's unread sms. So user sees 2 notifications: one from default/stock messaging app and another one from mines, which is messing.
I can't find which broadcast fired when there's unread sms?
Any ideas, hints?
You can set the priority of your receiver this way, so you know that it has the top priority and will execute the onReceive() method:
<receiver android:name=".SmsReceiver" android:enabled="true"
android:exported="true" android:priority="999">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>

Android - SMS - intent-filters priority listing

I was wondering if it is possible to find a list that includes all the receivers associated to a certain action.
For example I have the following receiver that executes everytime that an SMS is received:
<receiver android:name=".SmsReceiver" android:enabled="true">
<intent-filter android:priority="101">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
So with the priority="101" it´s executed even before than the default message service in Android.
I would like to find all the intent-filter associated to a certail action, in this case "android.provider.Telephony.SMS_RECEIVED"
I tried to get into /data/data/com.android.provider.telephony/databases but no info is stored in ther.
It would be great if anybody could tell me where can I find that info, and even if it is possible.
Regards,
Pablo
Use PackageManager and queryBroadcastReceivers() to find out all of the BroadcastReceivers that will respond to a given Intent. In your case, you would create an SMS_RECEIVED Intent.

Categories

Resources