Delete or use pop-up message after sending SMS

I have an Android app that needs to continue to send SMS. My problem is that whenever we send a message, we get a pop-up message (your SMS payments and your current time balance in the phone). When I send a lot of SMS, these pop-ups continue to accumulate one by one, which is undesirable for me. I need a way out to either remove or somehow absorb these pop-ups. Any ideas?

+4
source share
1 answer

pops up? Do you mean the toast? or notifications accumulating below the status bar?

You will have to forgive my seemingly simple question. In the USA, I had several Android phones, at least two operators, and I do not receive such a message in any form, but maybe because I always had an unlimited number of text messages, so additional texts did not cost me nothing,

I bet you are talking about notifications accumulating in the status bar. Therefore, if your operator does this, take a look at the code in "Demos API"> "Application> Notification"> "Status Bar"

In the callback attached to the "Clear notification" button, you will find the code you are looking for.

And if I could offer something, I know that many notifications accumulating on top of each other can be very annoying, but if you can try to combine all these notifications into one notification, at least with a work count (if only your user explicitly refuses notification). Thus, you still tell the user the most important part of the information - how many texts in general his phone sends so far, without completely suppressing it with a lot of notifications that basically the same event is happening again and again.

For those who don’t know, “API Demos” is a free application that you can download from the market. And there may be several, so just select one of them with five stars next to it, but the “Demos API” is also the same code example that comes with different SDKs when you download it using the SDK Manager, and you can get access this code when you create a new Android project using the New Android Project ... wizard from Eclipse, and then select the "Create an existing project from the sample" radio button (or something like that, I don’t have Eclipse in front of me, so the wording may be a little incorrect). And of course, if you are not using Eclipse, you can always find this sample code through the sample code code itself.

As a potentially more elegant alternative, or just in case your operator is really rude enough to pop up the actual modal dialog every time you send text, maybe your operator uses a broadcast receiver to trigger these notifications or these dialogs, so if so , and, I hope, the operator does not use “100” as a priority for his recipient, maybe you can register the receiver with “100”, and then kill the broadcast before it spreads to other receivers ki. But, of course, assuming that your carrier has developed such a path for you.

0
source

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


All Articles