How to automate Android by code and GUI in Tasker?


Question

I have Samsung Galaxy S4 GT-I9506, Android 5.0.1 Lollipop. I am using the application, Tasker. I feel it is too visual. I would like to write its profiles and events by code such that I could easily communicate about them with my friends. For instance, how you can write the following process from their homepage in code?




during the night, turn on airplane mode to conserve battery/reduce radiation, but turn it off every 15 minutes to check for SMS/voicemail.




It would be so great to have a better control of Android's UI by functions. I think the GUI is not enough. I studied the case further. Tasker can do airplane mode only in Android 2.2-4.0. The application recommends to use Secure settings plugin and rooted device to get the feature. It would be great to understand why Tasker fails with such a feature in later versions of Android.



Any applications (MacroDroid) are ok for solutions but their solutions must be stable with explanation why they work. Like pointed above for Tasker, the change of the Android version may make the program not working. I think this kind of situation can be avoided by using APIs or designing APIs i.e. understanding which API we need for such communication. Much Android is hidden but still something can be thought through.






How can you automate by code and GUI in Android?


Answer


Tasker can do Airplane mode only in Android 2.2 - 4.0. The application recommends to use Secure Settings plugin and rooted device to get the feature. It would be great to understand why Tasker fails with such a feature in later versions of Android.



The biggest reason why some Tasker tasks are broken on different Android versions is, because it doesn't require root access. From their website,



This simple concept profoundly extends your control of your Android device and it's capabilities, without the need for 'root' or a special home screen



Note that Secure Settings needs root access for Airplane mode. From its Play Store description,



Actions:



  • Airplane Mode [System+ required 4.2+]

  • Airplane Mode Radios [System+ required 4.2+].



The System+ indicates that the app needs to be installed as system app, which requires root.





.. the change of the Android version may make the program (i.e. Tasker) not working. I think this kind of situation can be avoided by using APIs or designing APIs i.e. understanding which API we need for such communication



Partially right. The change of the Android version also affects Android API, and since Tasker only uses the API, it becomes its weakness. Take an example of Airplane mode on Android 4.2+ (on Stack Overflow). The code for Airplane mode is working for Android 4.1, but then it's broken since Android 4.2. It's due to change in system's settings structure. CommonsWare explains it better on his website,



Lots of people have already chimed in on StackOverflow about Settings.Global, notably the fact that AIRPLANE_MODE is no longer available to be modified in Settings.System. Now, only signature|system apps will be able to toggle on and off airplane mode, which will wipe out many an app widget.



Due to the fact that Tasker doesn't require root access, combined with the change in Android API, some of Tasker tasks did and may fail in the future. Finally, that's the reason why there are many 3rd-party plugins that require root access to workaround with Tasker's limitation.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes