Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is it possible to make a shell script that would run using Smanager, for example, to do the following:

  1. Kill a list of custom apps loaded from a file
  2. Run one custom app loaded from the same file
  3. When that app is closed, restore killed apps

If that's not possible, then could it be split into two scripts, one that kills all the custom apps and launch one custom app, the other to restart the custom apps?

All of this is on a rooted phone. Thanks.

share|improve this question
    
This is all more than possible on a rooted phone, but before any of us begin writing the script, may I ask why you would want to do this? I mean, why go through the trouble of re-loading the killed apps? If you're eager to get started on this, Tasker would be the easiest way for you to do it, albeit it'll cost you $8 USD –  rm-vanda Aug 12 '12 at 18:38
    
Thanks for the comment. What I basically want is some sort of "Game Mode", activated before launching a game, desactivated after exiting it. For example, I have some apps bulletproofed (e.g. keyboard, whatsapp, viber, etc) and it would be nice to kill them before launching the game and launch them again once I'm done. –  GermainZ Aug 12 '12 at 18:47
    
That would not be a good idea IMHO - that would be a battery killer - since explicitly killing other apps and services that are not yours, those services and apps will end up getting restarted... and tbqh, killing other apps just for the sake of "Game Mode" is very bad idea and if that was published - there'd be uproar about it... –  t0mm13b Aug 12 '12 at 19:16
    
I wouldn't be killing system services, only user apps such as: viber, whatsapp, SwiftKey, etc. –  GermainZ Aug 12 '12 at 19:19
    
Also, gaming isn't exactly battery friendly, and killing some user apps does pay off on lower end devices. In my case, it nullifies the lag while playing PES. –  GermainZ Aug 12 '12 at 19:37
show 3 more comments

3 Answers 3

up vote 1 down vote accepted

You can use an Tasker to kill apps when you launch your game. And you are also able to do the opposite, when your game gets closed, Tasker can initialize other apps.

You may use the trial version to test this, but I believe that better results can only be achieved with root.


Tasker

Tasker by Crafty Apps available from Google Play Store (4,49€)

From their website you have a free 14-day trial download.

share|improve this answer
    
Are you affiliated with Tasker? Just curious as you've posted the near identical answer in another question... :) –  t0mm13b Aug 12 '12 at 19:31
    
@t0mm13b Nop :) I been playing around with it the past few days, and it solves a lot of headaches :D –  Zuul Aug 12 '12 at 19:33
    
@t0mm13b coincidentally, Tasker can be the solution for this past two questions :) But I'll be looking for unanswered questions to promote even more Tasker :D –  Zuul Aug 12 '12 at 19:35
    
yeah, its a dead handy tool alright :) Takes a bit of getting used to their logic which seems counter-intuitive... –  t0mm13b Aug 12 '12 at 19:36
    
I created a test task (vibrate for 500ms) and it doesn't seem to do anything when I run it (by pressing the play like button)... Not sure if it's a bug or if I got it wrong. –  GermainZ Aug 12 '12 at 22:07
show 1 more comment

Fast Reboot will get the job done for you.

Whenever you want to play your game, just launch Fast Reboot and then launch your game. It will free up some extra RAM without interfering with anything critical, and it is much easier than a script.

Don't worry about restarting the apps, because as t0mm said, they will almost immediately restart themselves. (You can launch Fast Reboot twice to see this)

This solution will solve your needs without having to pay for Tasker.

Although, I do recommend that app- it can do anything.

share|improve this answer
add comment

In order to start in game mode, I thing you can use the following commands

pm enable package_name

and

pm disable package_name

then you should restart some application services like whatsapp in order to restart checking automatically (Not sure if they will automatically restart services since package has been disabled) to do that you can use am command, but not sure what where will be the best arguments. You can use the logcat command, to debug what intents are being launched.

If you only kill the application it automatically will restart few seconds.

In SManager, at this moment it is not possible execute script after app has finished. But it could be a new feature.

You also should kill SManager in the las line of the script.

killall os.tools.scriptmanager
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.