Block incoming SMS on rooted Android 4.4 and higher? - android

In accordance with the doc:
Note that—beginning with Android 4.4—any attempt by your app to abort
the SMS_RECEIVED_ACTION broadcast will be ignored so all apps
interested have the chance to receive it.
so, only default SMS app can do it and looks like nothing is changed with Android 5.0 (due to unknown reason, according issue is marked as Obsolete).
Is there any way to block incoming SMS for non-default SMS app if phone is rooted (this is is needed for spam-blocking app)? How to do it?

You could write a service that overrides CarrierMessagingService .
If the bind to this is successful , then the message is not delivered to the main app.
BIND_CARRIER_MESSAGING_SERVICE permission required to register as carrier messaging service requires the app to be system app. So you need to push your app to the system.

Make your app the default SMS provider. Then it can register for SMS_DELIVER_ACTION. In that receiver, you can choose to either write the SMS to the database or not. If you choose not to, the SMS is basically ignored. If you choose to, any other app can receive the SMS.

You can try the following solution:
Iterate through list of packages capable of handling SMS and disable them programmatically.
To get an API to disable an app you will have to become an MDM(Mobile Device Management) partner app.OEMs provides additional APIs to their MDM partner apps to control the device.For example samsung provides api to disable specific app.I guess they also have APIs to control permission of specific apps.
Alternatively I guess the new android Device/Profile Owner mode must have an API to disable specific apps.

Related

How do I replace Messages app on Wear OS?

I want to create an app for Wear OS to replace the default Messages app for handling SMS/MMS messages. To start with, my app will get messages from the phone, relying on the phone to communicate with the cellular carrier. What does my replacement app need to do to send and receive SMS/MMS messages from the phone?
Can my app communicate with the default Google messaging app on the phone (so I don't have to write a phone app too)? Is that protocol/API documented somewhere?
Does my app need to register with the watch to become the default message handler and disable the default app? If so, how do I do that?

How to detect if user paired with a BLE device using the Android Bluetooth settings?

My app allows users to pair with specific BLE devices fine, but if my app is put in the background and the user pairs (or unpairs) with the BLE device using the Android bluetooth settings, my app is not aware of this. I've tried using ACTION_PAIRING_REQUEST, but my receiver never receives it. Would someone illustrate how to do this, or point me at example code that does?
Try using ACTION_BOND_STATE_CHANGED instead.
I don't know if that's the case but be aware of Implicit broadcasts restriction. Some broadcasts cannot be registered in AndroidManifest.xml anymore.

How to solve "For your messages security, System message app has been set as the default message app” issue on Oppo devices?

I implemented an SMS app. Now I'm having trouble with Oppo devices because whenever a message is received, the system changes the default app to the built-in app and shows this message:
For your messages security, System message app has been set as the default message app
I need to solve this issue programmatically as thousands of users will be using the app and I cannot let them change it manually
Found this in a other thread on OPPO:
Whatever settings you change for the messaging will not make any difference, the phone will always revert to the default app.
I took this up directly with OPPO and had the following response:
We decided not to allow customer to set 3rd party applications as default message application, for security of the devices cannot be guaranteed. We also want to let you experience our built-in application and to be spared from the malfunction like virus, bug or etc.
Not the response I wanted or expected!
Possibly the phone has been set this way is because in China the government is granted access to all private communications as a way to preserve a permanent dictatorship? Thus Chinese brands may be knowingly spreading these settings in android devices around the world.

Android Auto initiate SMS via voice

Is it possible to create/send SMS using voice commands in Android Auto? I'm not seeing anything about it in the docs at https://developer.android.com/training/auto/messaging/index.html
I have an HTC 10 and when the stock HTC "Messages" app is set as the default, I can tap the mic and say something like "Text Alice" or "Send a message to Bob" and it will then prompt me for the message, listen, and then send it. Similarly, if I set the Android Messages app (from Google) as my default SMS application, it works fine.
Lately I have been using Signal as my default messaging app. I cannot initiate a message via Signal. If I'm using Android Auto and I say "Text Bob" it will send an SMS, but it does NOT send a Signal message even though it's the default SMS app. Instead, it will send it through the HTC Messages app even though it's not the default.
Looking at their code, they have implemented the ANDROID_AUTO_HEARD and ANDROID_AUTO_REPLY intents as mentioned in the documentation. See lines 485-497 of https://github.com/WhisperSystems/Signal-Android/blob/master/AndroidManifest.xml and then the 2 Android Auto notification handlers at https://github.com/WhisperSystems/Signal-Android/tree/master/src/org/thoughtcrime/securesms/notifications
There doesn't seem to be any sort of ANDROID_AUTO_SEND intent or anything of that sort.
Is it possible to add an intent (to Signal) to make Android Auto send SMS through it instead of the other apps? I don't understand why it isn't using Signal when it's set as the default messaging app on my phone. The Android Messages app handles this properly. Is that just because Google put some special code into that app that third-party developers aren't allowed to use?

Sent SMS by my application shown in default android application

I am developing an android application in which my application send some message which have some specific codes and these codes used to operate my device. And my device is not phone it's an another custom hardware device (Developed an another hardware which is used to control other hardware such as AC/Cooler etc).
Now problem is that whenever my application send any SMS this is shown in SMS default application (O.S 5.0 or greater). While in my phone O.S. 4.2 these sent SMS not shown. And that's what I want. These specific codes should not shown to any one.
I know this is some API change android have done in SDK but there is any solution to overcome from this problem.
only solution for this problem can be "Delete the sms from Sent folder/table of SMS database."
But on or after Android 4.0, Deletion from SMS database is not allowed by public apps. SMS deletion not allowed

Categories

Resources