Automate actions on docking and undocking
Using tasker with the Padfone
robfisher, Tuesday 17 July 2012 - 13:02:00

Tasker is an app that lets you run things automatically on Android in response to various events, sensors or whatever.

I wanted to switch keyboards automatically depending on whether I am using the phone screen or the tablet screen (I use SwiftKey 3 and this does not like switching displays at all!)

Tasker does not know about the Padfone, but I found out that when the phone is docked to the Padfone Station (tablet) it thinks it is on AC power. Tasker does have detection of power source, and AC power is distinct from USB power (which you get from your PC if you are transferring files, for example) so this solution should be good enough.

Another limitation is that Android does not allow changes to the input method without user interaction, so the best we can do is display the input method chooser after docking or undocking, but that's quite useful. Tasker should be able to do other stuff also, like restarting any apps that have died.

1. Buy and install Tasker.

2. Before doing anything else, go to settings -> ASUS Customised Settings -> Dynamic display switch list and make sure that Tasker is checked, otherwise it will just get closed when you switch displays and none of this will work.

3. Open Tasker and get through all the introductory stuff which is probably worth reading as it's quite a complicated app.

4. Create a new profile by clicking the + on the profiles tab. Call it "Docked" (the name doesn't really matter, but this makes sense).

5. Choose "State", then "Power", then "Power" again, then set "Source" to "AC" and tap the green tick.

6. Choose "New Task". Tasks are just actions that you can set up to do stuff. Name the task "Choose Keyboard".

7. Click the + to add an action. Choose "Task", then "Wait" and then set the "Seconds" slider to 5. This gives us a time delay as I found that the Padfone is not really responding too well right after it is first inserted into the dock. Click the green tick.

8. Click the + to add another action. Choose "Input" then "Input Method Select" then click the green tick (ignoring the "If" checkbox).

9. Click the green tick again to create the task.

10. Long-press on the "Choose Keyboard" task you just created and select "Add Exit Task". Select "Choose Keyboard" again. This makes Tasker show the keyboard chooser when you undock as well as when you dock.

That's it! You should find an ongoing notification that tells you either the "Docked" profile is active or that there are no profiles active (when undocked).

Instead of "Choose Keyboard" you could also create tasks called "Dock" and "Undock" and have different sequences of actions run.


this content item is from Padfone Club
( http://padfoneclub.com/pl/content/content.php?content.12 )