Home » Android » android – Restarting SystemUI using am startservice

android – Restarting SystemUI using am startservice

Posted by: admin June 15, 2020 Leave a comment


I have been trying to restart SytemUI using these in my app,but it is not working,am on Android 4.0.4.Any help?

am startservice -n com.android.systemui/.SystemUIService

It works in adb shell,but not in my app or in terminal on android.

Code I am using in my app:

Process mSuProcess; mSuProcess = Runtime.getRuntime().exec("su"); 

DataOutputStream mSuDataOutputStream = new DataOutputStream(mSuProcess.getOutputStream()); 

mSuDataOutputStream.writeBytes("am startservice -n com.android.systemui/.SystemUIService\n");
How to&Answers:

Run shell instead of su, like;

Process mSuProcess;  mSuProcess = Runtime.getRuntime().exec("sh"); 


After a lot of searching on the internet, I managed to get the System Bar to appear in a 4.2 device using:

am startservice --user 0 -n com.android.systemui/.SystemUIService

Alternatively some people have used the -a (instead of -n) option, though this was causing a error or my device:

Error: Not found; no service started.