0

Currently my tablet on Android 4.0.4 (rooted) sometimes switches on by accident, which I don't want. (I'm cycling through Africa and sometimes power connections are minimal.) I need a way to shutdown the tablet after starting up. So something like:

  1. Start on boot
  2. After X (say, 10) minutes, prompt me to continue with a "Yes" button (in case I use it)
  3. If I select "No", shuts down and completely powers off the tablet.

I tried several apps but cannot find a solution. Any suggestions?

| improve this question | | | | |
  • Ermm... what if "Yes" button is accidentally pressed while cycling? Perhaps a timeout of 1 minute is sufficient... However, as already noted by Firelord, the current wording makes this question off-topic. – Andrew T. Oct 30 '15 at 9:04
1

You can use Tasker (paid; 7 day free trial) and its Scenes to achieve the goal.

Example:

(Click image to enlarge)

IMG: IMG: IMG:

Instructions

(Note: root access is needed to shutdown the device.)

  1. Go to Tasker → Scenes and create a scene named Auto off.
  2. Per your taste, set the size of the scene.

    You can add text using Text element. The Yes and No in the images are also text elements but you can opt for button elements too.

  3. Similarly, create a separate scene for Yes and No options named Yes and No.

    While you've not asked for confirmation, I've considered Andrew T.'s point legit and genuine, hence, separate confirmation for Yes and No selection would do good.

  4. I'm giving a broad idea here.

    • For each element of scene, under Tap there is an option to execute an action when the element is tapped once.
    • Show scene and Destroy scene options are available under Scenes action category.
    • For any Show scene, set Display As: Overlay Blocking and uncheck Show Exit button -- this would force you to choose an option in a scene and avoids the scene getting closed by a hardware button, such as Back button.
    • Wherever you want to show the timer, mention %Scount.
    • Auto off scene,

      • for the Yes element, destroy Auto off scene and show Yes scene
      • for the No element, destroy Auto off scene and show Yes scene
    • Yes scene,

      • for Yo man! element, destroy Yes scene and do Task → Stop → Auto power off
      • for Shutdown now element, select System → Reboot → Type: Shutdown
    • No scene,

      • for Just do it! element, select System → Reboot → Type: Shutdown
      • for Hell no!! element, destroy No scene and do Task → Stop → Auto power off
  5. Profile, task and actions:

    1. Profile: Event → System → Device Boot
    2. Task: (Name: Auto power off): (Actions):

      1. Task → Wait → set Wait as the time period after which you want to seek user intervention to continue or shutdown
      2. Scene → Show Scene → select your first scene (Auto off)
      3. Variables → Variable Set → Name: %Scount, To: set 60 or maximum number of seconds for auto shutdown timer
      4. Task → Wait → 1 minute
      5. Variables → Variable Subtract → Name: %Scount, Value: 1
      6. Task → GoTo:

        • Type: Action Number
        • Number: 4
        • If %Scount > 0
      7. System → Reboot → Type: Shutdown

Supplementary info:

  • %Scount is your custom global variable which should be equal to the maximum value of auto shutdown timer, such as 60 for 1 minute or 60 seconds.
  • In the task Auto power off, the variable gets set to maximum value of timer after the first X minutes wait is over and first scene is shown. This is what starts the timer.
  • For timer to work, Tasker waits for one second, then subtracts value 1 from the current value of %Scount, decides to wait for one second and do the subtraction again, if the variable's value is not zero, and once the values reaches zero device executes the shutdown action. (I learned about the timer from the post by nooblikeyou here.)
  • In the Yes and No scene, the task Auto power off is supposed to be stopped wherever you choose to continue using the device, else, once the timer completes the device will auto shutdown.
  • The solution would work even if the screen is off.
| improve this answer | | | | |
  • I've tested my solution on Android 4.2.1 and 5.0.2, if it matters. – Firelord Nov 17 '15 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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