Run Android application as Shell User

后端 未结 1 1753
清酒与你
清酒与你 2021-01-16 04:35

In my application, I need to start a native binary that opens and read from some /sys/kernel files. If I launch the native binary by connecting using adb shell

相关标签:
1条回答
  • 2021-01-16 05:06

    The shell UID is reserved for development and testing. Running an app with shell privileges is circumventing Google's security model. So you will not be able do it on a secured commercial device without rooting it.

    A possible temporary (non-persistent between reboots) workaround would be:

    1. Use adb shell to start a background service process, running as shell UID

    2. In your application, using IPC to ask the service to perform special task for you

    0 讨论(0)
提交回复
热议问题