Search code examples
androidadbandroid-7.0-nougatandroid-jobscheduler

Scheduling jobScheduler jobs via adb in rooted device


I'm using the jobScheduler API for scheduling repeated job. For testing, while running command adb shell cmd jobscheduler run -f com.foo.bar.application 1. It is working fine in non rooted device but when i execute it in a ROOTED DEVICE, i'm getting the following exception--

java.lang.SecurityException: Uid 0 not permitted to force scheduled jobs

The run-as reports it's not debuggable app.

How to test on rooted device?


Solution

  • You can try to unroot the adb shell.

    The normal uid is 2000

    uid=2000(shell) gid=2000(shell)
    

    You can switch the adb to non rooted mode with

    adb unroot
    

    Then try to run your command