Baradé
Baradé

Reputation: 1342

How to avoid "Permission Denial" when reading SMS via adb?

I have connected my Android smartphone in debugging USB mode with my Linux. Running this shell command:

adb shell content query --uri content://sms

leads to

Error while accessing provider:sms
java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms from pid=15666, uid=2000 requires android.permission.READ_SMS, or grantUriPermission()
        at android.os.Parcel.createException(Parcel.java:1959)
        at android.os.Parcel.readException(Parcel.java:1927)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
        at com.android.commands.content.Content$QueryCommand.onExecute(Content.java:619)
        at com.android.commands.content.Content$Command.execute(Content.java:470)
        at com.android.commands.content.Content.main(Content.java:690)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:371)

There is no su command in my adb shell:

/system/bin/sh: su: not found

and I have not rooted my smartphone (which seems rather complicated).

Is there any way to allow adb to read SMS? I have read about granting permissions but this can only be done for packages and am not running any app to read SMS. Besides, I want to avoid rooting the device. I would expect being able to read SMS since I have enabled the USB debugging mode anyway and can do all kinds of other stuff like starting phone calls with adb.

The smartphone has Android 9 and is rather old. Using a newer smartphone with a newer Android version would be another option.

Upvotes: 0

Views: 64

Answers (0)

Related Questions