How to put up a permanent shield while playing "Clash of Clans" and avoid getting disconnected due to inactivity (Android; Llama)

If you are a fan of the popular game "Clash of Clans," you have probably been on marathon raids where you try to raid as much gold and elixir as you possibly can. Every five minutes you tirelessly press the "reload game" button so that you don't get raided. Then you have to go somewhere for just a few minutes and when you come back to your game you find that "you have have been disconnected due to inactivity" and you have just been raided. All of the gold and elixir you have been raiding for the past hour or two is now gone.

If only there was a way "Clash of Clans" would never log you out for inactivity... There is! And it is awesome!
One way you could keep Clash of Clans from logging out is by hiring a monkey to press the screen every minute or so. Not very practical. OR, you could build a machine that does that very thing. That would be cool, but again, not too practical. Another option would be to have an app that keeps the game alive for you. Now we are talking.

Currently, there are a handful of apps that act as a shield for your game and keeps your game alive so that you do not get raided. Just to name a few; "Shield for CoC," "TH Shield - COC Tool," and "Clan Guard." These apps all work in a similar manner, you push a button and it continuously opens the game "Clash of Clans" for you.

While all these apps work, they have some drawbacks. For one, in order to use them, you must go to the app, then turn it on; after you are done playing, you have to return to the app and turn it off. Not a huge deal; perhaps a slight annoyance. Another drawback is that you cannot use other apps on your phone when this is activated; each time you open another app, "Clash of Clans" comes back on the screen disrupting whatever it was you were doing.

Today I have been testing an app that I think works better than all the other apps. 

It is called Llama.

Llama is an app that automates tasks on your phone. We will use Llama to prevent us from getting disconnected in "Clash of Clans." (I should mention that Llama is free, has no ads, and can be used for many, many, awesome things on your phone.)

We will set Llama so that each time "Clash of Clans" is open, it will continue to reopen the "Clash of Clans" app every four minutes. Because the app is already open, the screen will not change and the inactivity clock resets on the game so you will never get logged out for being inactive. You can leave the game on your desk all day, never touching it, without getting raided.

Here is how this is done:
Step 1
After you have downloaded Llama, you need to open the app and go to the "events" tab. Click on the "+" icon to add a new event.

Step 2
Give your event a name. I named mine "Clash of Clans." Press OK.

Step 3
Press the "Add Condition" button. Conditions are what Llama will be looking for to be true before applying an event action.

Step 4
Scroll until you see the "Active application" condition and click on it.

Step 5
Here you have two options. If you want "Clash of Clans" to only stay on when you have the app up and running, select "App started or in foreground." If you want "Clash of Clans" to continually open even if you are trying to run another app, then select "App stopped or in background."

I personally prefer "App started or in foreground."

Step 6
After you select this, you can press the "Choose an app" button.

Step 7
Scroll until you find "Clash of Clans" and select it.

Step 8 (optional)
Add another condition (see Step 3). Scroll until you see "Charging or Unplugged" and select it.

Step 9 (optional)
Select "Charging from any source."
What is going on here:
I am adding this condition so that the permanent shield hack will stay on only when I am playing Clash of Clans, and only when I am charging my phone. If you opt out of steps 8 and 9, it will still work, but it will drain your battery rapidly. I have noticed that when I charge from USB doing this, the battery still drains, just at a slower rate then running simply off battery. I suggest that you always use this hack when you are charging from AC (in fact, you may even wish to choose the "Charging from AC" option).

Step 10
Press the "Add Action" button.

Step 11
Scroll until you find the "Run Application" button, then press it.

Step 12
Scroll until you find "Clash of Clans" option then select it.

Step 13
Press the "Advanced..." option.

Step 14
Scroll down until you see the "Repeat event" option and make sure it is checked. Now press the "Repeat interval" option.

Step 15
Select 1,2,3,4, or 5. It does not matter what you select as long as it is 5 minutes or below.
"Clash of Clans" logs you out due to inactivity every five minutes. What we are doing now is reopening up the game every [whatever you selected] minutes. Whenever the game is reopened, the inactivity timer is reset.
In my first experiment I selected 5 minutes. It worked but I saw that the inactivity window came up right before the game restarted. Anything less than 5 minutes, the game does not actually restart (though you might notice a flicker on the screen when the game "opens" up again even though it is already open). For this reason I think 4 minutes is best. 

Step 16
Press the "back" button on your phone a time or two. This will save the changes you have made. When you go back to the Llama home screen it will say "You have edited a repeated event. Do you want to check if its conditions are valid so that it can start repeating?"
You can select either yes or no. (Not all conditions will be correct because "Clash of Clans" is not active on the screen.)

When you look at your events now, you should notice that the conditions are written in red or green text. The red text means that the condition is not being met, green means that the condition is being met. If you look at the screenshot below, you can see that my phone is charging (green text).

You are done! You can now open "Clash of Clans" and as long as you have it charging (if you selected that option) and have the game open, you will never be logged out due to inactivity.

Some additional thoughts and notes:< I realize that a lot of this is super awesome geeky. If you are at all familiar with programming then this should all be easy and make perfect sense. If this is your first time doing something like this, it might be a bit confusing. Just know that what is going on is that Llama is looking for the app "Clash of Clans" to be running and when it is, it will continuously open the app so that you never get logged out. You will not actually see the app opening because it is already open.

A couple of limitations that I have noticed. One is that if you have your screen set to timeout after a minute or two, you will need to change it so it stays on. I have actually done this in Llama; I have Llama programmed so that any time my phone is charging, the screen will never shut off unless I manually turn it off. Another limitation that I have noticed is that sometimes when you are looking for villages to attack, if it is actively searching (white clouds) at the same time as the game starts (we set it for every 4 minutes) then it will restart the game, SUPERCELL logo and all. I notice this to be prevalent in the shield apps that I mentioned at the beginning of this article (they seem to restart the game every 10 seconds or so). I have NOT had this happen with the 4 minute reset time. I have only had this happen once and that is when I was testing a 1 minute reset time. This is why I have chosen 4 minutes.
Note: This hack ONLY works while you have the game open (this is no different from the other shield apps). If you leave the game to open another app, the hack is no longer active and you obviously run the risk of getting raided.

Some thoughts on the Llama app:
Hopefully it is obvious, but I feel that I should mention that I LOVE Llama. It is hands down one of the coolest apps I have used on Android. If any of you reading this would like to know how better to utilize this app, let me know and I would be happy to do more tutorials on how to use it. Just to give you some ideas on how I use Llama.
  • Llama will make my screen stay on any time my phone is charging.
  • When I plug in my phone at night before I go to bed it will automatically open up my clock app to use as an alarm clock.
  • When I leave work or my house, it will turn off my Wifi and turn on my data.
  • When I go to work or my home, it will turn off my data and turn Wifi back on.
  • When I go to work or church, Llama puts my phone on silent.
  • Etc.
There are so many things you can do with Llama. Seriously, if you have any question about it, just write it in the comments below and I would be happy to reply.

About McKay


  1. Hi there! I'm wondering how you set up Llama to keep your screen on? (not really good with technology here!) Thank you!

    1. Please let me know which part of the tutorial you don't quite understand and i will be happy to try to clarify.

  2. is this trick still working? what about people like me who use both wifi and 3g to change the settings for that? and how to add multiple COC game in single android mobile thanks

    1. Sorry for the late reply. I have not been able to get this to work on Android version later than 4.4.4. I will keep trying to see if I can figure it out.

  3. Have set this up exactly as above for my htc one with repeat time of 3 mins - but still keep getting logged out when I check the settings. Llama is on in accessability - what am i missing??

    1. I have it working on one of my phones but not an another. I suspect it might have to do with different versions of Android. The version of Android I have that it is working on is 4.4.4. I think it does not work on versions after that but I honestly don't know why.

      If anyone knows why perhaps they could comment. Sorry. I will tinker with it more and see if I can figure it out.

  4. Hey guys...Its working on my Lollipop..So, I think they have fixed something which makes it work on this version too..Thanks..

    1. Thanks Stu for the comment. Glad to know it is working on your Android with Lollipop!

    2. Hey its not working on my device, i have done everything as u mentioned but still i get logged out :( plz help me

    3. I m using Samsung galaxy s6 edge 5.1.1 lollipop its not working :(

  5. I'm running a VM of Anroid and it works really, just played around with it. Use Bluestacks virtually on a pc so your phone screen doesn't die. And when you use it you can just turn off the monitor and go do stuff.

  6. Ok so basically this just keeps it from losing connection due to inactivity but i cant do anything else ony phone or it wont work Anymore so whats so amazing about this? Unless im not understanding something

  7. Ok so basically this just keeps it from losing connection due to inactivity but i cant do anything else ony phone or it wont work Anymore so whats so amazing about this? Unless im not understanding something

  8. this is s*** it dose not work any more since the "big coc update"

  9. I dunno if it works or not but after every 4 or 6 hours u WILL be disconnected from the server itself and u cannot stop it from happening!

  10. Hi I have a question that how to say llama to make my screen on when I am charging my phone

  11. Hi I have a question that
    How we can use it for coc when app stopped or background option is selected pls tell me nd thx

  12. Great Tutorial -- Well written -- Easy to do -- Thanks very much

    1. You are very welcome. I have not played COC for a long time so I hope this method still works!

  13. I used it and set it to 4 minutes and i keep getting attacked!! Help me plz thx

  14. Hello! I just have a quistion, from this tutoril did you mean that it only not disconnected from the game IF im playing while charging? How about not playing and also not charging? Thnks

  15. Using Llama you can keep COC open while charging or not but you do have to be "playing" the game (or at least have the game open).

  16. this definitely doesn't work as of late instead i use shield for coc


Powered by Blogger.