0

I'm trying to run an insert command in an app to another app. I'm taking my ADB Shell command:

adb shell content insert --uri content://com.***.***/device_info --bind store_id:s:12345

Converting that to Java:

Uri contentUri = Uri.parse("content://com.***.***/device_info");
ContentValues contentValues = new ContentValues();
contentValues.put("store_id", storeIdString);
mContext.getContentResolver().insert(contentUri, contentValues);

However when I run that Java code I get the following error:

Unknown URL content://com.***.***/device_info

But if I run that ADB Shell command I get no issues. The same problem happens if I try to query the same URI in code, while the same query via ADB shell command works perfectly fine

Jeff Hatfield
  • 131
  • 2
  • 8
  • `to another app that has a content resolver. ` You mean: `to another app that has a content provider. ` – blackapps Oct 13 '22 at 18:56

1 Answers1

0

Found the problem.

As of Android SDK level 30, Content Providers have been limited via Package Visibility. Once I downgraded my app's SDK level to 28, it started working, but that introduced it's own set of problems.

Anyways I suggest trying out some of these suggested solutions.

Jeff Hatfield
  • 131
  • 2
  • 8