A small and simple Android app with a ContentProvider that can act as a relay
between adb and the system SMS Provider, allowing for access workarounds in
environments with insufficient permissions and/or message restrictions. For
example:
-
The shell may lack some or all of the necessary SMS permissions, leading to possible
SecurityExceptions and other failure modes. -
On Marshmallow and above, non-default apps can see only
inboxandsentmessages, and the shell may be constrained to the same restricted view.
The app offers two levels of access to the SMS Provider:
-
Read-only, by acquiring the
READ_SMSpermissionThis option is the most straightforward of the two. However, on Marshmallow and above, you will be able to view only
inboxandsentmessages. -
Full access, by temporarily assuming the default SMS app role
This one will grant you full read and write access on each applicable version, but your messaging will be largely nonfunctional while adbsms is the default. The only fallback facility currently provided is (optional) incoming SMS processing and storage to the Provider. Nothing else is handled, aside from some very simplistic event logs for a few things, and there is no way to send anything out.
After enabling the desired option, queries can be made as they usually are over
adb by replacing the authority in any content://sms URI with adbsms. (The
app's UI can be closed at this point; it's not involved in Provider operations.)
You'll have to check adb's documentation for details on all of its available options, but these few examples should at least clarify the URI modification necessary to access this app's Provider.
To list the number and text for all (viewable) messages:
adb shell content query --uri content://adbsms --projection address:body
Or just the sent messages:
adb shell content query --uri content://adbsms/sent --projection address:body
Or, to list all columns for the message with ID 137:
adb shell content query --uri content://adbsms/137
If you've set adbsms as the default SMS app, you can also delete messages:
adb shell content delete --uri content://adbsms/137
Or update an existing one:
adb shell content update --uri content://adbsms/137 --bind body:s:"Updated\ text"
Or insert a new one:
adb shell content insert --uri content://adbsms --bind body:s:"Draft\ text" --bind type:i:3
The type column corresponds to the MESSAGE_TYPE_* constants from the
Telephony.TextBasedSmsColumns contract, the values for which are
given in the following table.
| Type | Value |
|---|---|
all |
0 |
inbox |
1 |
sent |
2 |
draft |
3 |
outbox |
4 |
failed |
5 |
queued |
6 |
-
New versions will now be accompanied by a GitHub release with assets that contain an
apkof a release build variant signed with a debug key, which is the current setup in the module'sbuild.gradle.kts. This app isn't published anywhere, as it's intended to be sort of a homebrew tool for developers and power users, and the unusual configuration is used to apply ProGuard and whatnot to an "unsigned" build.I'm not encouraging anyone to prefer the pre-built APKs; they're simply a convenience for users who don't have the setup available to do it themselves, or those who just want a quick test. They're assembled using GitHub Actions and this local workflow, so you can be reasonably certain that there are no malicious injections or modifications.
The GitHub releases for automated builds will be created by user
github-actions, whose name links to https://github.com/apps/github-actions, which actually redirects elsewhere if followed. Workflow execution details can be found on the Actions tab. -
If you plan to use the Full access option in order to get at the hidden message types, you should know that not all SMS apps utilize each one. Though most use
inboxandsentconsistently, it seems that many apps simply don't usedraftand/or the others at all. I'm guessing that they save those messages to internal storage instead, for some reason. Just a heads up. -
I haven't implemented every possible
ContentProvideroperation inAdbSmsProvider, but it does cover all of the required overrides. I think that should be sufficient for everything that adb can do, but if you find something I've missed, please file an issue for it.
MIT License
Copyright (c) 2026 Mike M.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
