Power off screen - i do not know how to continue

56 Views Asked by At

I'm working on an app (JobService) that should restart the device once a week using an ADB command (from the code). This works very well. Background: The device is used for navigation and is permanently supplied with voltage and switched on. The navigation app hangs after several weeks and requires a restart. The problem now is that after the restart the display is on and is kept awake by another application. I can only turn this off by pressing the power button. Android version is 6.0.1. Since there are many devices, the restart should be automated.

I have now pursued and tested many thoughts, unfortunately without success:

  • Internal code ADB command: "input keyevent 26"
  • Internal code ADB command: "sendevent /dev/input/event0 1 116 0"
  • Various options without ADB:
 mWakeLock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
 mWakeLock.acquire();
DevicePolicyManager manager = ((DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE));
manager.lockNow();

Solutions with brightness or a black overlay are not practical. There are many possibilities in these forms, but none of them worked. ADB only works when sent from the computer. Root is not available or unfortunately no option.

0

There are 0 best solutions below