0

I want to execute this command:

Runtime.getRuntime().exec("adb shell dpm set-device-owner com.example.msgshareapp/.AdminReceiver")

This didn't work, then I tried this:

Runtime.getRuntime().exec("dpm set-device-owner com.example.msgshareapp/.AdminReceiver")

And this does completly nothing, anyway of executing this command?

mohammed_sajid
  • 233
  • 2
  • 18

1 Answers1

0
val command = arrayOf("adb", "shell", "dpm", "set-device-owner", "com.example.msgshareapp/.AdminReceiver")
Runtime.getRuntime().exec(command)
lukas.j
  • 6,453
  • 2
  • 5
  • 24
  • When doing this, my app crashes. These are the errors: https://gyazo.com/9262d2460e627097ad4659dc16f5a8eb – mohammed_sajid May 16 '22 at 07:27
  • You have a "permission denied" error for running _adb_. I cannot help you with that problem as I do not program for Android devices. Maybe check out these answers: https://stackoverflow.com/questions/52682389/programmatically-executing-adb-shell-dpm-command-within-app-yields-cannot-run-pr – lukas.j May 16 '22 at 08:42