How to catch an incoming text message

I want to be able to control incoming text messages. My app is still in the "proof of concept" version, and I'm trying to learn Android programming on the go.

First, my application should catch incoming text messages. And if the message is from a known number, then deal with it. If not, send a message as nothing happened with the default text messaging app.

I have no doubt that this can be done, but I still have some concern, and I see some pitfalls in how all this is done on Android.

Thus, receiving an incoming text message can be quite easy - unless other messaging applications are installed, and perhaps the user wants regular text messages to appear on one of them - and this will happen after my The application will review it. first.

How can I be sure that my application will receive the first set of incoming text messages?

And after that, I need to send most text messages to any other text message application that the user selected so that the user can actually read the message that my application did not need.

Since Android uses relative intent at best, I don’t understand how to get my application to view all incoming text messages and then stop it or send it to the default text messaging application.

+4
source share
2 answers

Espen

The answer to this question is multi-part. At first, we understand that our company has solved this problem, but the solution is temporarily patented, so I will answer that I can, without causing a conflict either here or my company.

1) You can never insure your application from the first choice. What you can do is make your processing "fast enough" that doesn't matter.

2) Intent Absolutely if you solve a problem. Our company uses the concept of routing intentions. This ensures that the data is sent to the appropriate application. The most basic idea is that when you receive an SMS, you create a new intention (not the same thing) and send it directly to the class. This has some special considerations, but should give you some direction.

Unfortunately, without violating my company’s confidentiality or stackoverflow policy, I cannot publish it publicly until the solution is publicly available (within the next month).

Fuzzicallogic

+2
source

Sending all incoming messages is just a listener setup, you can do it easily see here

and after that its fine if you do nothing, but if you want sms not to be included in the messaging application, it is not recommended to prevent the user.

better wait a while and then delete it from the SMS database.

0
source

Source: https://habr.com/ru/post/1307870/


All Articles