Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restarting SystemUI using am startservice

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");
like image 744
Neal Avatar asked Oct 07 '12 06:10

Neal


2 Answers

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.

like image 92
TheIT Avatar answered Nov 09 '22 19:11

TheIT


Run shell instead of su, like;

Process mSuProcess;  mSuProcess = Runtime.getRuntime().exec("sh"); 
like image 31
auselen Avatar answered Nov 09 '22 20:11

auselen