I'm developing an app that will send very infrequent SMS messages from a foreground service. By very infrequent we're talking a few times per year at most, if the app is not severely misused by the user themselves.
I tested it the other day on a real device, and up popped a dialog that said something along the lines
AppName is trying to send an SMS.
Do you want to allow this?
Accept Decline
[ ] Never ask again
I don't remember the exact phrasing, and I haven't been able to reproduce it. I wouldn't swear on it, but I'm fairly certain it was on a device running Android 4.4.4.
This was the first time the app tried to send an SMS on this device, so I don't really think that it is related to SmsUsageMonitor.isUnderLimit(). Are there an other security checks and whatnot that would apply to sending SMS from a foreground service (including all versions of Android, not just 4.4.4)?
SmsUsageMonitor
seems to do some checking for "premium" numbers, and might possibly require some form of user acceptance in case an app tries to send a message to such a number. If this is the case, is there any way to "pre-approve" my app for sending to any number - including premium ones
- once and for all? Or could manual user approval still be required some time in the future, if for example a new recipient number (which might be a premium number) is used?