Wednesday, June 7, 2017

Automatically Toggle Samsung’s Always On Display When Charging [App]

Samsung gets a lot of flak for its performance optimization with regards to its software (though how much of that criticism is legitimate and/or accurate is a debate for another time), but it's hard to deny just how much added value their software brings. I could go on and on about all of the features you can find on the Samsung Experience (formerly known as TouchWiz), but today I'm going to focus on how to make one feature slightly better: Always On Display. Specifically, how to automatically enable Always on Display when charging, but disable it when not charging.

For those of you out of the loop, Samsung's Always on Display (AOD) feature is a special screen mode that displays when Android times out. In this mode, you can quickly see the current date, time, messages, calendar events, and more customizable features. AOD is exclusive to the Samsung Galaxy S7 and S8 series of smartphones and is a useful way to get a quick glance at important information without ever having to lay a finger on your phone.

AOD can be automatically toggled based on a schedule within settings, but other than that there's not many other contexts you can use to control when AOD is active. Fortunately with the power of Tasker, we can set whatever context we want to trigger when AOD is on/off. I've made a simple app that you can install and forget on your Samsung Galaxy S7, S7 Edge, S8, or S8+ that turns on AOD when charging only, but I'll also show how you can set whatever other context you want.

Download the AOD on Charge App from XDA Labs

Note: the above app was made using Tasker with Tasker App Factory. It does not have a UI. Please hide the app icon from your app drawer after installing it. I will attach the Project's XML file here in case you want to see how the app was made, or if you want to compile it yourself.


Tutorial – Trigger AOD Mode on Custom Contexts

Requirements

Although I'm using Tasker here, you're free to use any other automation app of your choice. Tasker is by far the most popular, and it's the one most people are familiar with, so that's what I'm using.

Option 1 – Toggle AOD Mode when Connected to Certain WiFi Networks

Here are step-by-step instructions on how to set this script up. I will focus on enabling/disabling AOD mode when you connect/disconnect from your home/work WiFi network, but you can set up any other trigger you want.

  1. Open up Tasker and tap on the + button in the bottom right to create a new Profile.
  2. Tap "State" to add a State context.
  3. Choose "Net" then "WiFi Connected."
  4. Under SSID, tap the magnifying glass to bring up a list of saved SSIDs. Choose your desired WiFi network here.
  5. Press the back key and Tasker will ask you to attach an existing Task or create a new one. Choose "New Task." Don't bother naming it.
  6. Once in the Task editing screen, tap on the + icon in the bottom middle to add an Action.
  7. Choose "Code" then "Java Function."
  8. Hit the coffee icon and select CONTEXT.
  9. Hit the magnifying glass near Function and search for getContentResolver().
  10. A new "Return" field should show up top. Enter "cr" here. Press back to return to the Task editing screen.
  11. Add another Java Function Action (steps #6-7). This time for the Class or Object field hit the magnifying glass and look for Settings$System. For the Function field hit the magnifying glass and select putInt. A set of parameters will now appear. For the Param (ContentResolver) hit the coffee cup and choose the "cr" object. For the Param (String) enter aod_mode. For the Param (int) enter 1.
  12. Press back to return to the Task editing screen. Now long-press on the two actions we made and tap on the clipboard button to copy them. Press back to exit to Tasker's main screen.
  13. Once at Tasker's main screen, long-press on the Task we just made and tap on "Add Exit Task." Don't bother naming the Task.
  14. When you're in the new Task's editing screen, long-press anywhere in the middle of the screen until the Paste action appears. Tap to Paste the two Actions we copied earlier.
  15. Tap on Action #2 here and scroll down. Change 1 to 0 under Param (int). Tap the back button until you return to Tasker's main screen, and you're done!

Option 2 – Trigger AOD Mode when Device is Face up on Table

Here are step-by-step instructions on how to set this script up. I will focus on enabling/disabling AOD mode when your device is laying face up.

  1. Open up Tasker and tap on the + button in the bottom right to create a new Profile.
  2. Tap "State" to add a State context.
  3. Choose "Sensor" then "Orientation."
  4. Under Is, make sure it says "Face Up."
  5. Press the back key and Tasker will ask you to attach an existing Task or create a new one. Choose "New Task." Don't bother naming it.
  6. Once in the Task editing screen, tap on the + icon in the bottom middle to add an Action.
  7. Choose "Code" then "Java Function."
  8. Hit the coffee icon and select CONTEXT.
  9. Hit the magnifying glass near Function and search for getContentResolver().
  10. A new "Return" field should show up top. Enter "cr" here. Press back to return to the Task editing screen.
  11. Add another Java Function Action (steps #6-7). This time for the Class or Object field hit the magnifying glass and look for Settings$System. For the Function field hit the magnifying glass and select putInt. A set of parameters will now appear. For the Param (ContentResolver) hit the coffee cup and choose the "cr" object. For the Param (String) enter aod_mode. For the Param (int) enter 1.
  12. Press back to return to the Task editing screen. Now long-press on the two actions we made and tap on the clipboard button to copy them. Press back to exit to Tasker's main screen.
  13. Once at Tasker's main screen, long-press on the Task we just made and tap on "Add Exit Task." Don't bother naming the Task.
  14. When you're in the new Task's editing screen, long-press anywhere in the middle of the screen until the Paste action appears. Tap to Paste the two Actions we copied earlier. Tap on Action #2 here and scroll down. Change 1 to 0 under Param (int). Tap the back button until you return to Tasker's main screen, and you're done!

Note: the rest of the steps in picture format can be followed in exactly the same way as the previous set of screenshots in option #1. Just start at the second row of screenshots and continue there.


Conclusion

As you can see, you can enable or disable Always on Display mode on basically any context that you want thanks to Tasker. The simple app that I made is aimed at covering the most commonly requested feature edition for AOD, but if you want something different out of AOD the power is in your hands to make those changes.



from xda-developers http://ift.tt/2rN9FgY
via IFTTT

No comments:

Post a Comment