> Attention!

New threads need to be created only inroot partition! In the future, they will be processed by moderators.

If you posted a new version of the program, please notify the moderator by clicking the "Complaint" button on your message.

Catalog of Android programs



Tasker | Performing actions on events



Rep: (40)
Tasker
Version: 5.9.3

Last update of the program in the header:06.08.2020

Attached Image


Screenshots
Attached Image
Attached Image
Attached Image

Attached Image

Gallery of screenshots:
- Tasker 5.9Tasker (Post just @ man # 92498338)
- Tasker 5.0Tasker (Post washerron # 68839498)
Screenshots of versions 4.x and 1.x are inold hat

Short description:
Performing actions on events.
Description:
Advanced scheduler. Allows for different events to make their own actions.
Looks likeLocale , Llama , Automagic , Automateit , Macrodroid , E-robot , Automate - automatic tasks , EasyProfiles , Dessin , Atooma , Swiponly much more powerful. It is possible to create widgets with an arbitrary list of actions.
Alternative Description:
A problem-oriented scripting language that allows programming in Android without knowledge of any programming languages ​​and no programming skills at all.

Homepage : https://tasker.joaoapps.com/
Google play : https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm

Download:
Version: 5.9.3 Tasker Paid on 04/08/2020 (betmen2)
Version: 5.9.2 Tasker (Post Serg R * # 93627176)

Beta versions:
Version: 5.9.3.rc Paid (~ Yurik-258 ~)

Officialchange history
version information

There are 3 official stable versions of Tasker:
- version for Android ≥ 5.0
- version for Android 4.x
- version for Android<4.0 (i.e., Androids 2.3 and below, for clarity, we assume that there are no longer any Android 3.x).
It is developing a version for Android ≥ 5.0, the remaining frozen. Laid apk - the standard version of the Google Play store, Google Play Licensing uses technology to verify the license (version Tasker 5.2).
If you have problems with the license, you can a) just buy Tasker and forget about them; b) use version 5.2.bf2 from the "Past versions" section.
Breaking Tasker is not recommended, there are a lot of opportunities in all can not be verified, so you'll never know, running hacked version or not. The topic has gained a lot of experience with hacked versions, it is very negative.
In the version name after the number there may be a suffix .bf with numbers, for example, version 5.2.bf1. bf means bugfix, i.e. update of the stable official version, in which there is nothing new, only bugs are fixed. The suffix .bf and the number after it are considered part of the version number.
There are no "mods" / "Rusks" for the program. Tasker requires neither.
In addition to stable versions of Tasker, there are beta versions, you can install them from the Google Play store by subscribing to the Android App testing beta program - Google Play Beta testing on the Tasker program page on Google Play. Beta versions have the suffix b after the number, for example, 5.1b. Links to beta versions in the topic header are not published. The beta versions themselves in this thread.not discussed, their support and advice-answers are handled directly by the developer. In this topic, the Tasker developer does not appear, so with all questions on beta versions, contact the developer through official channels, for example, on the official Tasker forum.
Up to version Tasker 5.1 inclusive (including versions for Android<5.0) two versions of the program were simultaneously released: an option for Google Play (had the suffix m after the version number, for example, 5.1m) and a directly purchased version of the program from the developer (Direct-Purchase version), which did not have the suffix m.
The variant without the suffix m was also official, had the same functionality as the option for Google Play, but additionally supported encryption functions. The variant without the suffix m is not broken, not tied to Google Play, with built-in license verification functions. (Possiblemethod of "getting" registration. If crashes when you try to enter the code, try thisversion of).
Also up to version Tasker 5.1 inclusive (including versions for Android<5.0) after the version number there could be a u - update suffix, a complete analogue of the .bf suffix for current versions, i.e. update of the stable official version, in which there is nothing new, only bugs are fixed. The letter u and the number after it are considered part of the version number. For example, version 4.3u4m is a stable version for Google Play, compared to 4.3m there is nothing new in it, however, bugs have been fixed; version 4.3u4 - version 4.3u4 directly purchased from the developer.
Download version for Android 4.x
versions 4.9u4 , 4.9u4m Tasker (Post Alex0047 # 57263470)
Officialchange history
App Factory Pluginversion for Tasker 4.9u4from off.site
Download version for Android< 4.0
Version: 1.6u2m (option for Google Market, not broken)
Attached fileTasker_1.6u2m.apk(1.34 MB)

Version: 1.6u2 (option, directly purchased from the developer, with encryption support)
Attached fileTasker.1.6u2.apk(1.34 MB)

Possible method of "receiving"registration for the last version of the program. If crashes when you try to enter the code, try thisversion of).

Unofficial translation into Russian for versions 1.6u2m, 1.6u2 is available.Tasker (Post Drum # 38518964)(in the program there is a very outdated Russian localization, see the note to paragraph 3 of the rules of the topic below).



ATTENTION!!!The rules of the topic. It is recommended to read carefully.
1. This topic follows Forum Rules , we ask everyone to observe them. Of course, in the subject act and Section Rules , in particular:
1.1. All pictures in messages should be hidden under spoiler .
Comment: This topic is not strictly moderated, messages that violate the rules will not be immediately deleted. However, it is known that some participants of the topic ignore messages with violations, therefore you risk not getting an answer to your burning question or getting an incomplete answer to it. And it is still unknown what is worse.
2. If you do not have the time or desire to read all the pages of a topic, then first use the search function in the topic (Section 4.4 Forum Rules ). Almost always you will find either a clear answer or a direction in which you need to move on. It is wiser to clarify the direction by asking a question in the topic. In the message with the question it is better to indicate what you were looking for, what you found, what you read from what you found, what you understood from what you read.
3. Even for the implementation of the simplest tasks desirable possess at least elementary skills and concepts related to programming (even if very superficial, at the school level).
Comment: But if you don’t have it, but you really want to realize something, you may not have it. Even the initial ones. Totally.
Important note: It is preferable to use English localization in Tasker (that is, English-speaking Tasker), Russian localization in places can confuse you, lead you on the wrong path, make you tear your hair where you still have it, etc.Example of "Russian" localization.
4. Beginners are encouraged to start with local ones. courses local ready solutions It is not harmful to look into the local library .
5. After asking a question and getting a “slurred”, as it seems to you, answer, read it again. This topic is a completely self-sufficient and unique organism. As a rule, each answer contains the words "anchors", hooking which in the "search", you will find a sufficient number of answers, and sometimes 100% ready-made solutions.
The note- A brief practical guide to finding a topic in the words-anchors: "how and what to look for in the subject".
6. A clearly formulated question with all-all-all the nuances increases the chances of promptly getting an answer. Information is never redundant.
Remarks:
- The message from one sentence is regarded by the regulars as an invitation to talk about the weather. And since here it is a deviation from the topic, in response you will most likely receive an offer to get acquainted with these rules.
- The message from one phrase "tried, did not work" means that they tried with the battery removed from the device, the screen was black, nothing happened.
7. If you can't write a profile yourself, and you want to contact the topic for help, then:
- describe in as much detail as possible the problem you want to solve and your problem, i.e. what exactly fails. Different people fail differently, you know.
- Be sure to post what has already happened in Tasker’s Description format (see FAQ, question 10 ).
Note: This "that" does not necessarily have to have any relation to the issue. We should know, at a minimum, the degree of your acquaintance with Tasker and the level of your programming skills. Otherwise, you risk getting an answer that you cannot understand. Yes, if absolutely nothing has happened yet, it means that you do not want to write a profile. If you think a little, then agree with the last statement.
Note: Read the discussionWishlist, answer, clarification, it shows how important it is to paint your Wishlist in detail.
8. If you want to share your decision, issue it in accordance with the FAQ, question 9 .
Opportunities
List of major events and states
Applications:
  • startup and shutdown applications, including tracking application activity services
  • run the selected operation (activity) applications (long tap on the application name in the application selection list for the Application Context)

Date Time:
  • offensive certain period of time and / or date, as well as day, week, month, day, week or month, the last day of the month
  • offensive and the end of a certain period of time

Developments:
Applications:
  • application change

Date Time:
  • change the system date, time, time zone
  • onset and end of events in the alarm clock, alarm clock change

Screen:
  • switching on and off of the screen, the screen unlocking

File system:
  • the file is opened, modified, closed, moved, deleted, changed its attributes

Equipment:
  • Pressing certain hardware buttons, including those located on the headset (wired or wireless)
  • long press the volume keys
  • connection, disconnection and removal of the SD card

Media:
  • changing music tracks

Network:
  • detect, connect and disconnect the Bluetooth devices
  • detection of NFC-tags

Phone:
  • incoming or outgoing call, answer the incoming, call completion
  • receive SMS (MMS), including non-text SMS (Data SMS)
  • successful sending of SMS (MMS) and an error when it is sent
  • missed call

Nutrition:
  • change the battery level, the achievement of full charge, the battery overheating

Sensors:
  • events from various internal sensors (illumination, proximity to the object, the orientation, displacement, magnetic field, atmospheric pressure, temperature, humidity, heart rate, pedometer)
  • spatial movement of the device specified in a certain way - a gesture
  • shaking apparatus
  • occurrence of significant movement (walking, cycling, movement in the car)
  • completed a predetermined number of steps

System:
  • change the settings in the provider system settings (the settings provider)
  • the end of the download of Android and the beginning of the shut-off
  • the achievement of a small amount of free memory
  • the occurrence of certain system events in Android - reception Intent (intent)
  • change locale
  • obtaining records in the system log (logcat)
  • add, update, or delete applications
  • clicking an icon in Quick Settings
  • change your desktop wallpaper

Internal events Tasker:
  • monitor service starts
  • launch of a second label (Secondary App Opened)
  • change timer widget tasks

Interface:
  • are requested to assist in the application or in the system
  • widget button press
  • or from an occurrence of any window (ordinary, pop, dialog)
  • appearance and removal of the notice on the application in the system notification bar, a user selection of such notice

variables:
  • set / cleared variable

Enter a geographical area (determined via GPS or cellular towers and WIFI access points) and the output therefrom

States:

Applications:
  • onset and end of events in the calendar
  • unread SMS (MMS)

Screen:
  • change screen orientation
  • screen status (enabled / disabled)
  • Activate or deactivate the screen saver (Android Daydream)
  • enabling and disabling a dark mode (Android 10+ and some devices for Android 9)

Equipment:
  • connection to a car or desktop dock
  • connection and disconnection of wired or wireless headphones
  • connect to the HDMI
  • hardware keyboard (open-launched / closed-retracted)
  • click tracking media keys
  • stylus event Samsung SPen: extraction of the holder, set in the holder, display and hide the menu stylus
  • connect to a computer via USB, and off of it
  • connection to the machine USB devices and disconnect

Network:
  • Activate or deactivate the mode "on the plane"
  • Activate or deactivate the auto-sync mode
  • connect to a Bluetooth device, the presence of a number of Bluetooth devices
  • Activate or deactivate the Bluetooth adapter, NFC, WiFi. WiFi hotspot, USB or Bluetooth (tethering), GPS receiver
  • connect through a virtual private network (VPN) and disconnect from the network
  • Ethernet connection and disconnection from her
  • establish and break the connection to the Internet in a particular mobile data connection: 2G, 3G, 4G and other
  • detection of certain (or any) WIFI access points connected to it or disable it from
  • incoming / outgoing call
  • detection aerial of a predetermined list of cellular towers
  • missed call
  • achievement and loss of a certain reception level cellular network signal

Nutrition:
  • battery level in the specified range
  • battery temperature increases to a certain level, the battery cooling below a certain temperature
  • the machine enters a low power (sleep) and exiting (Device Idle)
  • connect and disconnect the charger (wired, wireless, USB bus power)
  • Activate or deactivate low power mode (Battery Saver, Powe Save Mode mode)

Sensors (if any):
  • heart rate
  • humidity, pressure, temperature,
  • light, magnetic field, proximity sensor
  • change device orientation (face up / down, standing up, upside down, on the left / right side)
  • other sensors

System:
  • the start and the end of the user session
  • state settings in the provider system settings (the settings provider)

Internal states Tasker:
  • profile is active
  • task is performed
  • variable values

other:
  • arming and "do not disturb" and silent mode
  • change audio streams volume call, a call, a signal tone dialing (DTMF), alarm clock, ring tones, notifications, system-level alerts
  • Pressing the soft buttons and other elements of the user interface of Android, and third-party programs
  • changing contents of the clipboard (clipboard)

List of basic actions
Warnings:
  • supply a predetermined audio signal tone, volume and duration
  • the output pop-up message (it is also Toast, but in the universe Tasker is called Flash)
  • transformation of the text in the "Morse code" and its reproduction
  • the output messages and ordinary pop-up dialogs, including the authentication dialog with a password, pattern, fingerprint or other biometric information display menus and lists (in fact, possible to build arbitrary graphical user interfaces through scenes)
  • output notification in the notification panel, including followed by the LED and / or sound notifications, vibration
  • cancellation of own notifications
  • speech synthesis (including an entry in the file, and synthesis byWaveNet) And stop
  • control screen brightness LED, flashes, lighting of buttons
  • activation of the vibration, including in a predetermined pattern

Applications:
  • obtain information about installed applications and application components: operations (activities), services (services), communications receivers (receivers)
  • insert events in the calendar
  • enabling / disabling access to chamber
  • Go to the home screen, including with a certain number
  • launching applications, including choice of activities
  • Force Quit Applications
  • the launch of the last open application
  • launch the application shortcut
  • Open the list of recent apps
  • obtaining information on entries in the calendar
  • mode switching screen split

Audio:
  • volume control, including separate streams: a call, talking on the phone, including via bluetooth-headset DTMF signal (DTMF), alarm, tones, notifications, system alerts
  • setting the default ringtone for calls, alarms, notifications
  • Management silent mode and the "do not disturb"
  • mode control sound taps on the hardware and software buttons, navigation mode tactile (haptic feedback), sound effects
  • built-in microphone Control
  • switching the conversation voice stream to an external speaker and back
  • playback control ringtones and vibration for incoming calls, notifications arising

scenarios:
  • scripts to runshelljavascriptSL4A
  • use designs yazyka Java and call the Java language features and Android (via Java reflection mechanism)
  • implementation of ADB ADB commands through the WiFi interface (you must give permission)

Screen:
  • control settings screen: size, brightness, including automatic brightness regime and orientation, including automatic orientation
  • mode control "in the car"
  • Dark control mode (Android 8+)
  • control the duration period of inactivity to screen off
  • navigation control panel and the state, including the display of icons in the status bar
  • installation of wallpaper on your home screen and / or the lock screen
  • management screen lock: Activate or deactivate the lock, including forced switch-lock
  • control "night" mode (works only with the regimes "in the car" and "dock")
  • management regime of "always on" Never, when charging from the network and / or USB, the wireless station
  • obtain information about the characteristics of the screen: the screen size, the resolution, the current setting of automatic orientation
  • Control notifications panel: display panel and folding
  • receiving snapshots (screenshots)
  • on / off screen

File system operations:
  • directory operations: copy, create, delete, retrieve a list of files
  • file operations: copy, delete, move, reading, reading line by line, checking the existence of the record file, reading file attributes: size, permissions, modification time
  • zip archive to the archives and GNU zip (gzip), extract the zip and gzip
  • encryption and decryption
  • Transfer files in the application or device
  • opening files
  • launch the built-in file manager
  • [Root] remount the partitions on an internal or external memory card
  • execution of SQL queries to the database .db file

Google Drive:
  • authorization when Google Drive
  • upload, download, delete files and directories
  • obtain a list of files and directories

Images:
  • resize, crop, rotate, mirror, applying filters

Enter:
  • displays an authentication dialog (PIN, pattern, or biometric data)
  • Emulation keys ago
  • closing system dialogs
  • [Root] emulation including clicks on button and non-existent on the device, such as a joystick emulation - "universal Sledgehammer", which is almost all
  • voice recognition
  • Conversation data entry
  • call dialogue Input Method
  • keyboard emulation (no need root)
  • concluded dialogue with the list of items
  • long press the power button
  • replacing the onscreen navigation buttons
  • call the software keyboard
  • Output of text dialogue with the buttons (up to three)
  • [Root] emulation of text input

Location:
  • determining a current location (using GPS or cell towers and WiFi access points)
  • determining current location Stop
  • mode control positioning
  • the opening of Google Maps, including at a given point, navigate to any given point in Street View
  • O cards to select a location

Media:
  • capture in the exclusive use of certain hardware buttons
  • control the music player, including integrated
  • MIDI playback on the connected device via USB
  • playback of audio files embedded ringtones including with a selection of audio stream
  • record audio with a choice of audio stream (including calls)
  • obtain information about the audio file title, artist, playing time, the current playing track position
  • Forcing a scan card to media files
  • photography

Network:
  • mode control "in plane", including selectively disabling radios
  • Auto Sync mode control
  • enabling and disabling Bluetooth adapter, NFC, WIFI, WiMax, receiver GPS, mobile communication network, m. hr. control data transmission mode in the mobile communication network connection to management WiFi access point
  • pair, connect, disconnect Bluetooth devices
  • installing bluetooth device name in the network
  • information about connecting / close Bluetooth devices
  • download link in a browser
  • opening dialogue send Email
  • Work with web-servers: sending and receiving content, not necessarily in html format
  • network access control for applications
  • read / write data to NFC-tag
  • check the availability of nodes on local networks and the Internet
  • obtain information about the network connection (connection type, access to mobile data) on the Auto Sync mode, a WIFI network parameters (MAC-address of the adapter, signal strength, access point name) and the Ethernet, connection options through the VPN, the connected and paired Bluetooth devices
  • Activate or deactivate WIFI hotspot, USB tethering
  • WIFI sleep mode control

Phone:
  • switch during a conversation on the voice stream bluetooth-back headset and
  • Up to a certain number
  • management of incoming / outgoing calls to certain numbers: call blocking and call forwarding
  • Management magazine calls (open, full cleaning / missed / incoming / outgoing)
  • the creation of SMS and MMS
  • Answering a call ( "pick up") call termination
  • opening a contact in an external application (for example, a video call to a Skype or WhatsApp, navigate to the address in Google Maps)
  • opening contacts (last elected)
  • sending SMS, including non-text SMS (Data SMS)
  • range of applications SMS default
  • obtain information about contacts in the phone book

Working with Scenes:
  • creating, opening, hiding, destruction scenes, elements
  • obtaining information on scenes, elements

Settings:
  • opening different windows and dialog system application "Settings"
  • launch window with information about the system, information about the battery and an alarm clock, as well as other windows

System:
  • query the system permits
  • add a new alarm, cancel the alarm, turn off the alarm clock
  • [Root] Control processor
  • Management Processor operating modes
  • management of energy-saving mode
  • [Root] emergency shutdown and reboot the machine
  • Performing a search (on the device in the Web)
  • Sending an arbitrary system event - Intent (intent)
  • receive information from specific sensors
  • assistant selection
  • adding the contents of the clipboard
  • launch system stopwatch
  • Read and change system settings Android

Task Management:
  • operators to manage the organization's program: creation and modification of variables, arrays, if an operator-then-else, loops, subroutine call (in fact, even coroutines), mathematical functions, search and replace on a template, including using regular expressions

other:
  • work with databases and content providers (content providers): read, write and delete information
  • obtaining an identifier of the current user identifier of Android (Android ID)

Both of these lists are far from complete. First, a set of events, conditions and actions Tasker can be expanded by connecting third-party plug-ins, thousands of them. Second, using the emulation hardware and software buttons or scripts running on the shell and SL4A, you can perform any operation virtually. And besides, there is still receiving and sending intents. And if, in addition, learn to call a Java function, you can get the absolute authority over his staff.
Also in Tasker you can:
- Create your own shortcuts, including dynamic ones, and widgets, including in the quick settings panel
- Create your own user interface usingscenes ( short description )
- Create your own applications
Frequently Asked Questions (FAQ)

1. I can not update / install Tasker, what should I do?
- You are trying to update the Tasker version purchased directly from the developer (Direct-Purchase version) to Tasker 5.2 or higher. Since, starting with version 5.2, Tasker is distributed exclusively through the Google Play app store, such an update is impossible. Before installing, remove the program, after making a backup copy of their profiles. Few details - in the answers to the questionTasker (Post shahmatist2 # 74473831)(the following two messages).
More information about the differences in the options and versions of the program - in the sectionwith version information.
- You install the version of Tasker below4.5 and you don’t have the Google Maps Android API library in the firmware, i.e. com.google.android.maps.jar and com.google.android.maps.xml files. They can be found in this topic, using the search, or search in the firmware for your device. A couple of recipes: Tasker (Post pioneer2010 # 15274629) and Tasker (Post coolkaas # 19016305) .

2. How to import a project / profile / task / scene?
For importing, “long tap” is used on the headings of the tabs profiles, tasks, scenes, on the headings of the project tabs or on the tab with the icon “home” (where everything that is not part of any project is located), the menu item is called Import. Files for import are in xml format and .prj.xml extensions (project), .prf.xml (profile), tsk.xml (task), .scn.tsk (scene). The project file already contains all the profiles, tasks and scenes of the project.
In addition to the XML format in Tasker, there is a Description format, written about it in10 FAQ.

3. Do Tasker need root-rights (root)?
- Some Tasker actions require root-rights, some profiles laid out here, in the section MCI, require root-rights.
- Part of the action (e.g., action System Lock - lock device) need to Tasker scripting device administrator. Sometimes (for example, an event New Window), is required to Tasker service was included in the special features. Also (eg, for Notification events), it may be necessary to allow for Tasker was allowed access to the notification of third party applications. Several examples of such special settingsTasker (Post just @ man # 50495922).
- Part of the context and action require Specials System permissions kotorye impossible to issue through the regular application interface "Settings" Android. For example, Secure Setting action requires authorizationWRITE_SECURE_SETTINGS (examples and explanations), The state of Media Button - permitsSET_MEDIA_KEY_LISTENER, Event Logcat Entry - resolutionREAD_LOGS, Volume Long Press Event - resolutionSET_VOLUME_KEY_LONG_PRESS_LISTENERAnd to check running application services Application context requires permissionDUMP.
- Action ADB Wifi allows you to execute commands in a shell session Android Debug Bridge (adb). The word "Wifi" to the name of the action only added to give a magical brightness to this trivial hack. Action ADB Wifi is completely analogous to Run Shell action, the only difference is that the shell itself is started within adb-session, not within Tasker. But because adb-session transactions carried out on behalf of the usershell, The number of operations allowed higher than the influence of Run Shell. Of course, talk about the complete replacement of root-session and action Run Shell with the option Use Root is not necessary. To effect ADB Wifi to work, will have toto sweat.

4. I cannot find half of the functions voiced in this topic in my version of Tasker, many functions are highlighted in red (unavailable), what am I doing wrong?
- Tasker manipulates a large set of contexts and actions to somehow streamline and distribute them, the interface uses a hierarchical structure, for example, the App category, the Go Home action. The same hierarchical structure is used for state and event contexts. Fortunately, it is not necessary to remember the categories for actions and contexts, the interface provides the Filter field, which greatly facilitates the search, seeTasker (Post by sergr59 # 40051612). In addition, a long tap is used throughout the interface (both on the elements and on the tabs), as well as dragging and holding. The interface is devoted to the sectionMain Screenof.books. In tasker<5.6 the default mode was set for beginners (Beginner mode), in which some features were not available (interface elements), the mode could be disabled in the Tasker settings. (In versions 5.6+, this mode has been removed.)
- When discussing actions and contexts in a topic, the English interface of Tasker is usually used (see. Note to clause 3 of the rules of the topic). Perhaps, if you switch the interface language in the Tusker settings, all of the missing functions will suddenly appear.
- Most of the actions highlighted in red can be replaced by plug-ins, but, as a rule, root will be required. For example, for a long time, the GPS action was unavailable in Tasker; however, it could be replaced with GPS actions. Enabled / GPS Disabled plug-inSecure settings. (Now there is a Location Mode action in Tasker, which allows you to indirectly control the GPS receiver.) You need to understand that after installing the plug-in, the action will not cease to be red, however, in the plug-in section, an action with the same functionality will appear.
- If you do not have root, you can sometimes solve the problem by issuing a special permit Tasker. Details are set out inFAQ 3.
- In addition, especially for those who like to delve into the guts of the system, all sorts of recipes are discussed in the subject, allowing you to achieve the desired without installing plug-ins, through a direct appeal to the functions of Android. (Look in the "Little sports tricks" section,MAAif you are interested in similar recipes. For example,MAX 10- analog GPS action for Android 4.0+ and Location Mode for Android 5.0+,MAX 12- Replacing the action of Mobile Data 2G / 3G. And the replacement action Mobile Data -MAX 4andTasker (Post Primorsky78 # 37418838.)
Please do not ask in the thread when this or that action is returned to Tasker. He will never be returned. Use plugins.

5. I am asked to lay out the Run Log and / or logcat, what is it and how to get it?
See little sports tricks,Debugging Secrets.

6. Is it possible with Tasker to create a separate application, apk?
Yes, it is possible. Plugin requiredTasker App Factory. Instructions are in the section.App Creationof.books.

7. I have a mega idea, but I’m not going to study Tasker, but I’m ready to pay for its incarnation + $ 100,500 $, who should I contact?
It is better to refer to the topic.Custom programs. Tasker topic price list ishereat the end of the post, paragraph 3.

8. What makes Tasker different from other similar programs?
Usually, tasks in Tasker are solved much easier than in other programs. This is achieved through two concepts unique to Tusker: state and action-tuning. Without these concepts, most elementary problems either have no solution at all, or the solution turns out to be extremely difficult.
For example, consider the simplest task "Turn on silent mode at night (at a meeting)". Most planners offer the following solution:
event: night fell (meeting) ->enable silent mode
event: morning came (meeting ended) ->turn off silent mode
Stop! And why, in fact, "turn off"? And if you had to turn on silent mode before and you need to leave the device in this mode, eh? It is clear that you need to restore the previous value of the mode. Unfortunately, the vast majority of other planners are not able to do this. Tasker can. Here is the profile on Tasker:
condition: Night (meeting)
task: turn on silent mode
Everything. It seems that the profile is completely wrong? Where is the mode off? He is not. Tasker himself will restore the mode: if at nightfall (meeting) the mode was silent, Tasker would leave it silent, if the sound was turned on, Tasker would turn off the silent mode.
Those interested can try to make a similar profile in another program. In principle, the profile of this level can still be implemented on anything, but you have to sweat.
An example of a profile that can be implemented outside Tasker is almost impossible - the secondexamplein the message.
Details on the states, superposition of states and action-settings can be found inThe course of the young fighter.
In addition, Tasker allows you to implement almost any idea, because it allows you to create your own user interface (scenes), allows you to communicate with Android directly and in its own language (Java Function action). True, almost always for the implementation of ideas is also required an understanding of the Android device.

9. With the help of Tasker, I managed to solve a problem that could save our Galaxy from destruction, how can I share the solution?
At present, the connection with the intergalactic congress has been lost, but we are ready to share your decision with humanity! For this you need:
- put your solution under the spoiler in Tasker’s Description format (see FAQ,question 10).
- answer your questions on the profile, fix the errors found
- put the final decision under the spoiler in Tusker Description format.
You can also put an additional copy of the decision and in xml format and / or pictures if you want. Also, in addition allowed to spread links to TaskerNet. In other words, the format - Description iscompulsory , other formats, including xml format, links to TaskerNet, pictures - desirable.

10. What is Tasker's Description format? What should I do to get my projects, profiles, tasks, scenes in this format? What is the code that is found in almost every post on this topic?
Tasker's Description format is a text with a description of the program on the Tasker. It looks like this:
Task in Tasker's Description format
Battery Line Width (68)
A1: Test Element [Scene Name: Battery Bar Element: Background Test: Element Size Result In:% size]
A2: Variable Split [Name:% size Splitter: x Delete Base: On]
A3: Variable Set [Name:% size To:% size1 / 100 *% BATT Do Maths: On Append: Off]
A4: Element Position: Scene Name: Battery Bar Element: Background Orientation: All X: 0 Y: 0 Animation Time (MS): 100]
A5: Element Position: Scene Name: Battery Bar Element: Line Orientation: All X: 0 Y: 0 Animation Time (MS): 100]
A6: Element Size [Scene Name: Battery Bar Element: Background Orientation: All Width:% size1 Height: 3 Animation Time (MS): 100]
A7: Element Size [Scene Name: Battery Bar Element: Line Orientation: All Width:% Size: 2: Animation Time (MS): 100]
A8: Perform Task [Name: Battery Line Color Stop: Off Priority: 5 Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable:]
How to get your work in this format, the words explainshere, and clearly -here.
Detailed explanation in picturesTasker (Post by sergr59 # 47858893).
The menu item Data / Description / Write File will create a copy of all your current work (profiles, tasks, scenes) in the Description format in the Tasker / datadescr.txt file on the sd card. For Tasker versions<4.x A file in the Description format is created automatically during the backup and is called userbackup.xml.txt.
It is impossible to import the Description format into Tasker, it can only be created by hand by typing a profile according to the description. The xml format is intended for full import.
If you want to ask a question or share your ideas, then along with the Description format we recommend also indicating the Android version and the presence (absence) of root-rights.

11. Is it true that there are telepaths in this topic who can give a clear answer to an incompletely formulated question?
Not!Unfortunately, our two telepaths disappeared without a trace, and the third went on vacation, but hasn’t returned until now (we still hope that he hasn’t gone and will definitely notify everyone when he returns)
All our telepaths were found and discoveredyour topic! All questions are asking there!

12. Looking at the statistics of memory usage, I saw that Tasker occupied 100/50/20 MB of RAM. I think that is too much. Is it possible to somehow curb Tusker's appetites?
- (short answer) You can. Exit the profile editing window.
- (detailed answer) Tasker consists of two unequal parts:
- The Tasker application itself, which implements the functions of editing profiles and their debugging, contains a settings menu and on-line help, etc .;
- a service that monitors contexts and implements the queue of tasks and actions.
The first part really requires a significant amount of RAM to work. However, as soon as you finish editing your profiles and exit the application, only the service will remain from Tasker, which usually does not require a lot of memory. The exact figure depends on the contexts and actions you use, but rarely exceeds a couple of megabytes. The maximum allegedly observed volume is 10 MB.
In addition, you need to be aware that the figures drawn by Android for the first part of Tasker, show the average temperature in the hospital, the pressure at the North Pole, but not the actual amount of RAM occupied. To understand where these figures come from, I recommend carefully reading two notes by Dianne Hackborn, an Android developer well-known in narrow circles (And what is the last name, eh? No nickname is needed): answer to the questionHow to discover memory usage of my application in AndroidandProcess Stats: Understanding How Your Uses RAM
Since Tasker is only an interlayer for Android functions, it shares memory with Android (due to the PSS metric used in Android for calculating the amount of RAM), and since Tasker is an interlayer for many functions, it shares memory with almost all Android. Hence the big numbers for the first part of Tusker: Android simply attributed half the amount of memory to Tusker.
At that moment, when only service remains from Tasker (and this is most of the time), only the necessary Android function profiles and tasks are used - the amount of memory used by Tasker is supposedly reduced. But we understand that in reality nothing has disappeared, it’s just that Android stopped attributing to Tusker its memory.
From all this we can draw the following conclusion: the PSS metric in the case of Tasker is not quite correct. Yes it is. However, an ideal metric does not exist in principle, and in the case of an overwhelming number of applications, using the PSS metric is a reasonable enough solution.

13. Looking at the statistics of power consumption, I was surprised to find that Tasker is constantly busy with something, he uses 90% / 50% / 10% of CPU time / battery. I think that is too much. Is it possible to somehow curb Tusker's appetites?
You can, think about what exactly your profiles do.
It should be clearly understood, Tasker itself does not occupy the processor, does not discharge the battery. This is all done by user-written profiles. The official manual has special sections.Power usageandLocation Without Tears(how successfully translated in due timev-oz, "Positioning without hemorrhoids"), devoted to methods to reduce energy consumption. If you read them carefully, it will become clear that, for example, the Orientation or Proximity or Location contexts with GPS should not be used alone in profiles. If to you, of course, your battery is expensive. You must additionally specify contexts such as Time, Call, Variable Value, etc.
Sometimes users, after active experiments with Tasker and long debugging of tasks, forget to stop manually started tasks. As a result, the task is quietly spinning in a loop, and in the% TRUN variable it is not (since such tasks are often lazy to give names). And you can detect it only by turning on the debug log in Tasker.
From here council: always stop queue of performance of tasks after experiments.

14. My Tasker does not see root, what should I do?
Solution options:off.FAQ, translationsTasker (Post Nukri # 52499605)andTasker (Post axbat # 52501154)(equivalent, read any choice),practical recipe.

15. On my Android, Tasker does not work reliably: it does not activate contexts, it skips actions. What to do?
- Possible solutions for Android 5.0+ contained in of.FAQWhy does not Tasker work in the background on my device?. Android 5 - 7 relevantTransfer the contents of the oldpartition Android System Power Management of.rukovodstva. Some manufacturers plaid such things previously, e.g.,Tasker (Post by sergr59 # 38359613). MIUI users will have to tinker further, for example,Tasker (Post earth77 # 55617867)(Problems of modern versions of MIUI outlined in of.FAQ). If you think that was read of.FAQ to the holes, then you need to read it again.
- You want to enable location services, see.Tasker (Post Demon72 # 59472287):
+ For the correct operation of context and variable WIFI Near% WIFII (when not connected to the WIFI access point) on android 6.0+;
+ For correct operation context WIFI Connected to specify the MAC and SSID or variable% WIFII (when connected to a WIFI access point) on android 9.0+ (and for some devices - from Android 8.1);
+ To work correctly context Cell Near and variable% CELLID on Android 8.0+.
Comment: Tasker should also have the right of access to the location the and androids 10+ this access must be provided constantly.
- If the profiles use plugins, all recommended above, you need to apply to the plugins too.

16. Due to Tasker on line states (and the lock screen) displayed alarm icon. Why is it necessary? Can I remove it?
Time required by the context and action Wait (see. FAQ 15) to work correctly. The appearance of an alarm icon is determined by the option Use Reliable Alarms (which, since Tasker 5.7, also has Always default). Disable icons in the status bar can effect Status Bar Icons. It is not recommended to change the value of the option Use Reliable Alarms, even if it seems to you that you do not need it. Believe me, Tasker knows better than you, you need it or not. Details about the -Tasker (Post by username11 # 85007795).
Local Courses

1. Course young fighter(for newbies)
Summary:
- The basic concepts of Tasker: action, task, context, profile;
- what is the difference between the context-state and the context-event;
- what is the action-setting;
- several contexts in one profile;
- input and output profile tasks.

2. Tasker: A Practical Guide
Summary:
- simple profiles;
- variables;
- pattern matching;
- mathematical operations;
- cycles;
- arrays of variables.

3. Fundamentals of performing arts
Summary:
- what is a scene;
- create a scene;
- how to coordinate the scene design with the Android interface.
Local Library, Video Tutorials Collection

Read:
- Tasker lessons on androiddp1
- Tasker basic concepts from 3dnews.ru(thankVityaPda)
- example lessons from fans-android.com
- informative articles fromv-oz (It is recommended to read other articles in the blog)
- private librarywith exclusive "manuscripts" compiled by a local art historianslax

Look:
- PRO Tasker channel (by e8genius)
- playlist "Tasker" by androidp1
- channel "Tasker in Russian"

Readings (in English):
- Official resources:Manual(in particular,system variables Tasker), FAQ, Wiki, Forum, Tasker Feature Requests / Bug Reports.
- Benjamin Linnik's blog posts about Tasker(thankroman.kaskad)
- Live examples from pocketables.com(there are articles not related to the tasker, someone messed up with tags). In particular, a series of articlesBeginner’s guide to Tasker(thankVityaPda)
- Tasker Tutorials By Ryoen (Google+) Tasker Tutorials By Ryoen Deprouw
- Tasker on Reddit(The developer is present)
- Tasker Week at xda-developers
- Tasker Resourceson the IzzyOnDroid website. A collection of textbooks on Tasker.
- Questions tagged with taskeron Android Enthusiasts Stack Exchange. And that's it.

Watching:
- Video tutorials from Ryoen Deprouw
- Video lessons from Armando Ferreira
- Video lessons from hollywoodfrodo
- Video from pocketables.com
- for lazy google youtube ;)
Concise English-Russian dictionary of topics
task - task
action - action
setting - action-setting (used extremely rarely, and the Russian-language term is not entirely successful)
context
state - state, context is implied, i.e. state context - [context] state
event - the event, the same remark as for the state
profile - profile (if a profile contains exactly one context, sometimes the term "profile" can mean context and vice versa. And this has nothing to do with the Russian language.)
project - a project, a set of profiles, grouped together
scene - scene
scene element - scene element
description - here, in this topic, the Tasker Description format (see FAQ,question 10)
kid app - an application created from a profile (project) using the Tasker App Factory plug-in (see FAQ,question 6)
JS - actions JavaScript, JavaScriptlet, and also language JavaScript in general
JF - Java Function, Java Object actions, as well as the Java and Android API languages ​​in general
Tusker Plugins

Plugins are third-party programs that extend Tasker’s functionality by adding new actions and contexts. Many common programs are also plug-ins for Tasker.
- AutoAlarm version 1.0.25- An advanced analogue of the Alarm Clock event.
- Autocast version 1.5.1.bf- friends of Tasker withChromecast.
- Autocontacts version 1.1.18- reading and searching for contacts
- Autohue version 1.1.8- lamp controlPhilips HueandLIFX.
- Autoinput version 2.7.bf- emulates user interface events, for example, plays pre-prepared actions of clicking on the screen in certain areas; also allows you to specify the reaction to events in the user interface and extract the contents of the user interface elements; much more advanced analogFrep.
- Autolaunch version 1.0.24- dynamic launch of applications.
- Autolocation version 1.2- expands the Location context, providing access to the location providerfusedand geozones interface (Geofencing API), supports physical activity recognition (Activity Recognition API).
- AutoNotification version 4.1.4- expands contexts and actions working with notifications (notifications).
- AutoPebble version 1.0.31) - We are friends with Tasker Pebble.
- AutoRemote version 3.0.43b92- remote control of devices and BB, both via the Internet and via bluetooth (you can make friends and force Taskers to communicate with each other).
- Autoshare version 2.0.40- embed Tasker in the system menu Share.
- Autotools version 2.2.3- combine from a variety of actions that can not be briefly listed, see.AutoTools Guide.
- Autovera version 1.0.16- control of devices by protocolZ-wavevia Vera controllers.
- Autovoice version 3.5.5- voice control, extension action Say.
- The rest auto-plugins fromjoaomgcd, off.site.
- bluetooth Detection version 4.1.1- extension contexts BT Connected and BT Near.
- Broadlink RM Plugin version 2.3.2- control of the Broadlink RM controller (forum thread).
- Email me pro (download) - sending email (alternative solutionon SL4A), a similar plugin -Locale SendSilentMail Plug-In version 4.52
- RESTask for Tasker- supportRESTfulAPIs (GET, POST, PUT, DELETE).
- Secure settings, forum thread(installation of broken PRO versions is not recommended) - management of the Android system settings, in some places duplicating functions of Tasker itself, but part of the functionality allows you to greatly expand its capabilities[Root]
- SSH Tasker Plugin (download) - protocol client integrationSshin tasker
- Tasker App Factory- allows you to create a full-fledged application from a project in Tasker (.apk).
- TaskKill Tasker Plugin (download) - stop applications, the plugin is removed from Google Play due to violation of the rules of program placement[Root]
- Tasker now (download) - Tasker interaction with Google Now
- Toggle Network Type 5.0, forum thread- switch the preferred type of network, such as 2G / 3G[Root]
- Toggle data 5.0, forum thread- mobile data management[Root]
- Weather ACE Tasker Plugin- weather forecast through the Weather ACE application,explanationfrom the author of the application
- WhatsTasker (download) - we are friends of Tasker withWhatsappplugin removed from google play
- Big listplugins and supported applicationson of.sayte.
- Collectionplugins and supported applicationson the IzzyOnDroid website.
- Lists of plugins in other forum topics:Automagic, Locale, Macrodroid, modules xposed(some modules are integrated with Tasker).

Plugins for building your widgets, user interface, live wallpapers, integration with launchers:
- Zoom(from former author Tasker)
- Minimalistic text, forum thread
- Ultimate custom widget (UCCW), forum thread
- Zooper Widget Pro, forum thread
- KLWP Live Wallpaper Maker, forum thread
- Material Design Tasker Plugin version 6.1- create your UI in Material Design style
- Snackbar Tasker Plugin version 11.1.1- create your own interface type elementsSnackbar, Bottom barandBottom sheet
- Lightning launcher, forum threadprovides mutual integration with Tasker, details - in the wikiWorking with Tasker
MCI - local solutions (examples)

The examples given in the header are not collected in order to simply copy them (although this is possible, because they are all (or almost) efficient), but to understand and understand that, in principle, there is nothing complicated.

Attached Imagesimple profiles for beginners

1. Widget auto brightness on / off
If% Bright = 0
Auto Brightness Set On
Variable Set Name% Bright to 1
Else
AutoBrightness set Off
Display Brightness Level 3
Variable Set name% Bright to 0
Endif
Flash Text% Bright (this is for debug control, can be deleted)

and create a Tasker widget or shortcut, linking the task to it.
The code can be cut into two steps by using the Variable Add action with the Wrap Around parameter.
If% Bright = 0
Auto Brightness Set On
Else
AutoBrightness set Off
Display Brightness Level 3
Endif
Variable Add name% Bright value 1 wrap around 2]
Flash Text% Bright (this is for debug control, can be deleted)

Continuation- story about widgets.
2. Execution of scheduled actions (Tasker context Time)
2.1. Connection to home WiFi network and data synchronizationTasker (Post brake # 5066785)
2.2. SIM switch. Staging:Tasker (Post by dimonsob # 33970409). Decision:Tasker (Post by gavrila # 33974305)
2.3. Turn on WIFI. Staging:Tasker (Post kolik76_76 # 35332544). Decision:Tasker (Post by sergr59 # 35332785)
2.4. See example 16 below.
3. Battery Full NoticeTasker (Post sumoto # 6268990)
4. Displaying active profiles on the desktop usingMinimalistic text Tasker (Post LANstalker # 7008782)
5. Turn off the screen when the phone is placed on the table screen downTasker (Post roly # 7379740)(application is usedScreen off and lock)
Note. Screen Off and Lock are optional. Now Tasker has a System Lock action.
6. Shake control (Shake Tusker event)
6.1. Reset incoming shake and chimeTasker (Post MOPOK # 13271364)
6.2. Shake ScreenshotTasker (Post Nukri # 33921486)
7. Automatic WiFi controlTasker (Post rjlexx # 33556843)
8. Call on the last incoming numberTasker (Post skunsofob # 9357433)
9. Sound reminder about missed calls and SMS every 3 minutesTasker (Post intro555 # 30478905)(See also Example 19 below.)
10. Delayed actions - delayed launch technique (seeMAX 6)
10.1 Turn off Bluetooth if there is no connection for 3 minutesTasker (Post VityaPda # 15433144)
10.2. Bluetooth auto off after 1 minuteTasker (Post rjlexx # 33387106)orTasker (Post VityaPda # 33387312). Discussion (including links to other solutions):Tasker (Post by username11 # 33388672).
10.3 Screen lock by delayed proximity sensorTasker (Post slax # 37063616). See also profile 5.
10.4. A set of profiles that run after the screen is turned off with a delay: switch the mobile network to 2G Only mode, disable WIFI if connected to a specific AP, disable WIFI outside the AP coverage areaTasker (Post by dimusische # 38434559)
11. Turn off GPS, WiFi, mobile data transfer and access points via USB when the screen is turned off.Tasker (Post by taganrog32 # 15805624)
12. TTS-based talking clock taskTasker (Post Nukri # 16482906)modified versionTasker (Post Nukri # 40811001), another optionTasker (Post GigaMen # 39665630)
13. Launching the Camera app with full brightness using the search button.Tasker (Post gameover19 # 16813469)
14. Widget on / off applications (for example, Cyberon Voice Commander)Tasker (Post EvilShrike # 17198021)
15. Playing a ringtone on incomingTasker (Post skunsofob # 17329403)
16. Enabling the mode "in the plane" at nightTasker (Post by taganrog32 # 17643467)
17. Flashlight, just a flashlightTasker (Post by javerin # 21687565)(See also Java MCI 2)
18. Screen lock when calling with headset connectedTasker (Post tvv56 # 24317764)
19. Reminder of missed calls and SMSTasker (Post tvv56 # 24317911)(See also Example 9 above.)
20. Smooth increase in ringer volumeTasker (Post tvv56 # 25412353)DiscussionTasker (Post tvv56 # 25402750)
21. Notification of the disappearance of the cellular signalTasker (Post gameover19 # 28186341)
22. Turning off the device when reaching a critical level of charging in picturesTasker (Post coolkaas # 24929040)
23. Automatic answer to the call (alternatives to the action Take Call)
23.1 With ideas fromMAX 2: Tasker (Post intro555 # 44254063)(see the simplified version)
23.2. Using the AutoTools plugin:Tasker (Post shuraken31 # 77545926)
24. Voice request verification account. Staging:Tasker (Post Stimuliator # 31750382). Solution without plugins:Tasker (Post Nukri # 31750978)
25. Voice control using the pluginAutovoice
25.1 Running the application by voiceTasker (Post rjlexx # 33259309)
25.2 Auto control with alarm StarLine (with GSM module)Tasker (Post Spider # 48818745)
26. When connecting to a home Wi-Fi network, turn off Bluetooth and screen lockTasker (Post KlgFinn # 36303973)
27. Displaying card balance on the lock screen using a pluginDashClock Tasker Extension(widgetDashclock widget) Tasker (Post by gavrila # 39827385)
28. Device management (using the pluginAutoRemote) Tasker (Post KlgFinn # 55589289)(see also complex MCI 10).
29. Automation of the quick call function in Yandex Browser (plugin usedAutoNotification) Tasker (Post lupuslol # 59667358).

Attached Imageadvanced profiles

1. <Moved toMAX 13.>
2. How to send an e-mail from TaskerTasker (Post Oleg V # 21581197)(alternative see sectionplugins)
3. Turn on and lock the screen by the proximity sensorTasker (Post Remie-l # 15007005)
4. Turn on the computer via WiFi usingTasker (Post j0ker # 7649554) Wake on lan(example in pictures -Tasker (Post j0ker # 14247930) )
5. Alarm with SnoozeTasker (Post sergiii # 9754611)
6. Battery barTasker (Post Nukri # 15868156)and additionTasker (Post Calhoon # 15929667)
7. Starting and stopping DVGet service when data transmission is enabled / disabledTasker (Post Nukri # 15874032)
8. Conclusion consumed traffic on top of all windowsTasker (Post by taganrog32 # 17436431)
9. Lock screen on during a callTasker (Post intro555 # 31369886)
10. Locating a device
10.1. With sending coordinates to the server, we use HTTP Request (GPS tracker)Tasker (Post passerby # 88269829)
10.2. By remote request (via pluginAutoRemote) Tasker (EasyWorld Post # 31517883)(see also simple MCI 28).
11. Delayed launch of a browser with open links, an example of using arraysTasker (Post dimcus # 21030010)DiscussionTasker (Post dimcus # 21022095)
12. Notification of missed calls with voice output of the name of the contact from which the call was missedTasker (Post by keta22 # 24770624)
13. Battery LogTasker (Post coolkaas # 24951724)
14. Car radio emulationTasker (Post Arkkor # 25973066)
15. Advance notification of free minutes limitTasker (Post by sergr59 # 27804376)
16. Voice output weather forecastTasker (Post zurzmansor # 34347212). Another option isTasker (Post by ajm # 32677684). Alternative on baseWeather ACE - Tasker (Post Aleph4 # 31856902). Another option -Tasker (Post by ajm # 34565142). And another option - the current weather from Intellicast.com (for widget)Tasker (Post Graymax # 37077583). Option for the widget (using the pluginAutotools) - Tasker (Post WoxiFixs # 67784234)
17. Notification to which SIM / operator an incoming call on a 2-SIM phone and the incompatibility of operatorsTasker (Post by sergr59 # 35207240)
18. Auto Answer Call and SpeakerphoneTasker (Post intro555 # 44254063)
19. Changing the desktop wallpaper (using Java Script)Tasker (EasyWorld Post # 39600695)
20. Forwarding part of received SMS to Telegram by condition (using Java Script)Tasker (Post z-dmitry # 66748297)
21. Setting a random ringtone on the incoming, an example of working with scenes, the reaction to the events of scenesTasker (Post R3m # 83394496)

Attached Imagejava profiles

1. Getting the address of a place by its coordinatesTasker (Post v-oz # 39631433), clarificationTasker (Post by yhnyhn11 # 64456808)
2. FlashlightTasker (Post slax # 53903882)
And there are a lot of profiles that have not yet fallen into the header can be found in the topic by searching for a key phrasejava function.

Request to the authors of the solutions. Do not correct profiles (except typos) without prior notice and discussion in the topic.
MAA - little sports tricks

1. Debugging Secrets .

2. Interception and emulation of hardware keys, user interface elements:
To emulate hardware keys and user interface elements, Tasker provides for Button, Dpad, Type, Assistance Request, Button Widget Clicked, Button: Camera, Button: Long Search, and other contexts. Their functionality is limited, much more advanced functions are available in pluginsAutoinputandAutoNotification. With the help of these plugins, it is possible to emulate almost any action of the user interface and intercept almost any of its events. However, there are cases when plugins are powerless, and in many simple situations plugins are redundant. In this little sports trick, alternative plug-in recipes are outlined.
- hardware key emulation technique via sendeventTasker (Post v-oz # 12681202)
- technique of intercepting hardware keys via geteventTasker (Post coolkaas # 23702923)
- an alternative solution for interception - module xposedadditions pro
- method of emulation of clicks on the screen via input tapTasker (Post by gmorgen # 33262026); with pictures -Tasker (Post by sergr59 # 45647656)
- codes of buttons (from core / java / android / view / KeyEvent.java) for input keyeventTasker (Post by username11 # 21526131)

3. We catch events in the system log (logcat), applying the ideas of the Ministry of Agriculture 2 (in order for these recipes to work on your machine, they need to be slightly modified, catching the main idea):
- interlocutor picked up the phone (answered the outgoing)Tasker (Post dnsis # 25551292)
- Android's text-to-speech (tts) subsystem started workingTasker (Post by myxa781 # 24101465)andTasker (Post by myxa781 # 24224417)
Use the shell-script from the Ministry of Agriculture 2 is not necessary to have context-Tasker event Logcat Entry. However, the essence of the tricks that does not change.

4. Some information about the built-in svc utility in Android Tasker (Post slax # 53419279) .

5. Child topic from coolkaas Shell scripts for Android , which grew out of the Ministry of Agriculture 2. In the topic of programming on the shell (the action of the Run Shell Tasker). Short guide to the teams: Official BusyBox Guide ( description ), here is one of examples application.

6. Delayed launch
Sometimes you want to start a task not at the time of context activation, but a little later. To do this, use the delayed start method: the first action of the task is to set the Wait action, followed by the Stop If action, checking that the task start condition is still being met. This is usually a profile activity check, but there are other options.
profile "Profile Name"
context ...
task
Wait time
Stop If start condition
Of course, the delayed start method can be used for output tasks.
Examples of using the method:Tasker (Post by kefirux # 23641303)andTasker (Post by kefirux # 23646121)andTasker (Post by kefirux # 23660085). In addition, profiles using this method are dedicated tosimple mri 10.
Stop action with profile activity check done
Stop If% PACTIVE ~ *, Profile Name, *

Note the commas, a common beginner’s mistake is to forget about them when checking the% PACTIVE variable.


7. Combining Contexts for OR
There are three main methods. In the first and simplest, the property of independence of tasks from contexts is used — the task can be tied to several contexts simultaneously (this Tasker property is described in detail in "On the course of a young fighter" )
profile "Profile1"
context state context A
task "Task"

profile "Profile2"
context state context B
task "Task"

Disadvantages of this method:
- the task will be launched when each profile is activated;
- the output task, if needed, will also be launched when each profile is deactivated.
In general, this, of course, is not a union of contexts at all OR, or a very special case of such a union. But it works great in the simplest situations without abstruse bells and whistles.
The second method is based on the use of the Profile Active state (the profile is active). In the Name parameter (the name of the profile being checked by the context) there are comparisons based on the Tasker pattern (Pattern Matching). Using a simple matching pattern, we get:
profile "This is Profile1"
context state context A
task
Stop

profile "This is Profile2"
context state context B
task
Stop

profile "Profile1 or Profile2"
context state Profile Active [Name: This is Profile1 / This Profile2]
enter task "task"
exit task "output task"
In fact, if you correctly name the profiles, you can use the following template:
profile "Profile1 or Profile2"
context state Profile Active [Name: This is Profile *]
enter task "task"
exit task "output task"
that is, the context now checks whether any profile that starts with the word “This Profile” is active; both Profiles This Profile1 and This Profile2 will fall into such a template. Of course, you should not have any other profiles with the "This Profile" prefix.
You can also use the% PACTIVE system variable check:
profile "Profile1 or Profile2"
context state Variable Value% PACTIVE ~ *, This is Profile1, * / *, This is Profile2, *
enter task "task"
exit task "output task"
or even like this:
profile "Profile1 or Profile2"
context state Variable Value% PACTIVE ~ *, This is a Profile *, *
enter task "task"
exit task "output task"
This method most closely unites the context of OR. Note that the output of the task starts when both profiles are disabled, which is what we needed. (Indeed, the output task should run when the deactivation of context, ie, when the true negation of the activation conditions:. NOT (OR Profile1 Profile2) Using the known formula of Boolean algebra
NOT (Profile1 or Profile2)<=>(NOT Profile1) AND (NOT Profile2)

We get the condition profile deactivation "Profile1 or Profile2" on the right side of the formula.)
And by applying the negation to this formula, we get the idea underlying the third method
Profile1 OR Profile2<=>NOT (NOT (Profile1 or Profile2))<=>NOT ((NOT PROFILE1) AND (NOT PROFILE2))

In the right-hand side, we see the standard union of profiles according to I. To get those “NOT” inside the parentheses, you need to set a negation for the contexts in the profile, most Tasker contexts have the Invert flag for this. To get "NOT" before parenthesis, you need to make the task output for the profile.
profile "Profile1 or Profile2"
context state Not context A
context state Not context B
exit task "Task"
enter task "output task"

Disadvantages of this method:
- the method is difficult to enter it, you have to work hard
- the settings that are changed by the settings actions in the Task task are not saved, since the task is an output
- for the same reason, the settings that are changed by the action-settings in the task "Output task" are restored in the task "Task"


8. Correct shutdown (power off, reboot)
- All Androids:Tasker (Post by myxa781 # 30556899)
- Androids 4.3+:MAX 4

9. Secrets% evtprm - Tasker (Post Nukri # 33317770)

10. Manage location settings (GPS / network):
To manage the location settings in Tusker, there is a Location Mode action, however, it assumes that the location settings are standard, for some firmware this is not true. In addition, this action is available only for Android 5.0+. This little sports trick reveals the internal mechanics of the system location settings.
- control through the interface of the standard system widgetTasker (Post ivanius-1976 # 16390085)
- change location settings in content provider (provider) settingsTasker (Post slax # 64882379)(internal mechanics of Custom Setting).

11. Parsing (parsing) text data, for example, HTML pages.
- The main tool for parsing text data is the action Variable Search Replace. As the name suggests, it allows you to search for a given pattern in a string, as well as replace or remove parts of a string. The action relies heavily on the notion of a regular expression (regular expression, regexp):section of. leadership, section from the Android API Reference, online testerregular expressions. Examples of use are simple MRI 27, complex MRI 11 and 16.
- Since parsing html-pages with regular expressions iscthulhu pathIt is recommended to use the parsing tools available in JavaScript and Android (via JS and JF Tasker). Visual examples on JS:Tasker (Post Graymax # 43424823), Tasker (Post BanHammer [YKT] # 38500217). LessonParsing XML Datafrom Training Guides for Android developers.

12. Service call mechanics in examples
- switching of 2G / 3G / LTE network modes (calling ITelephony.setPreferredNetworkType method of phone service)Tasker (Post Partyzzan # 45844577)
- switching hardware overlay, hardware composer (calling the hidden method of the SurfaceFlinger service, details -onTransact methodclass BnSurfaceComposer)Tasker (Post by Alexey711 # 42782503)
- control of the WIFI access point (tethering) on ​​Android 7+ -Tasker (Post slax # 62396787)andTasker (Post slax # 66660280)
The method of obtaining information about the methods of services through the Tasker Java interface -Tasker (Post slax # 48226914)

13. Work with databases on the example of SMS database.
General comment. With the database, rather, with content providers (content providers) operate through the built-in Android utility content (available for Android 4.1+). Thus it is necessary to know the address (authority) of the supplier and the structure of its database. If the utility content in your Androide not, or if it is necessary to pre understand the database structure, use the sqlite-shell. Note, however, that the work with the database to record, passing the supplier may lead to its destruction. Everywhere below, unless otherwise stated, refers to the action Run Shell Tasker. Previously, of course, you need to fine-tune the work with the database on the command line. Basically, to work with databases and content providers in Tasker has a SQL Query action, so only use it without knowing the base (supplier) structure, is almost impossible.
- using the content utility, mark all SMS read, unanswered calls - viewedTasker (Post by gavrila # 44070856)
- using sqlite-shell, mark all SMS readTasker (Post by gavrila # 43833031)
- deletion via sqlite-shell SMS from a certain numberTasker (Post Havl # 18737162)
- scripts on SL4A python (action of SL4A Script Tasker's Run): one marks all SMS as read, the other deletes sent to a certain SMS numberTasker (Post Havl # 18852990)
Finally, actions for working with the SMS database exist in the Tasker Utils plugin (removed from Google Play, there is no topic in it), an example of a profile that removes specific SMS content from a specific numberTasker (Post brisker # 42600445)
miscellanea
Past versions
The previous versions of the program collected here are of interest only to archaeological historians who are exploring the artifacts of the Digital Age. No need to download these versions, hoping that they will work. The current official stable versions obviously work better. And if it seems to you that you have found a mistake in them, it is better to discuss it in the topic or write to the author at the forum.
version 5.9Tasker (Post Giacomino # 91778463)
version 5.8.2Paid (Novakin)
version 5.8Paid version (Novakin)
version 5.7.1Tasker (Post by Giacomino # 84894453)
version 5.6Tasker (Post Alex0047 # 78316391)
version 5.5.bf2Tasker (Post alen2012 # 77827876)
version 5.2.bf2Tasker (Post Alex0047 # 74571629)
version 5.1Tasker (Post Alex0047 # 69023208)
version 5.0u7Tasker (Post Alex0047 # 66567180)
version 4.8u5Tasker (Post Alex0047 # 50556293)
version 4.7u3Tasker (Post Alex0047 # 41599102)
version 4.6u3Tasker (Post Alex0047 # 37216898)
version 4.5u1Tasker (Post nihilihin # 34888513)
version 4.4u3Tasker (Post Alex0047 # 33631921)
version 4.3u4Tasker (Post by Henry1 # 31181212)
version 4.2u3Tasker (Post by Giacomino # 27022916)
version 4.1u3Tasker (Post by ScAnMaG # 22883929)
version 4.0u1Tasker (Post Oleg V # 21050872)
version 1.3.3u2Tasker (Post by ScAnMaG # 17226665)
version 1.3.2u1Tasker (Post MENNENN # 16762182)
version 1.3.1Tasker (Post roly # 14920421)
version 1.3u1Tasker (Post skunsofob # 14519505)

Key version of Tasker at the office. the sitehttps://tasker.joaoapps.com/releases/

If you want to help develop the Tasker theme, hereTasker (Post R3m # 99486981)compiled a list of tasks for filling the cap and structuring the topic.
p.s. Thanks to everyone who took / is / will take (and will take!) participation in the creation of the cap.

Post has been editedR3m - 04.09.20, 02:32
Reason for editing: updating opportunities



Rep: (842)
This meow got me, a simple sound output profile does not want to work. Added SS, to no avail.
Profile: Voice Every Hour (30)
Enforce: no
Time: From 8:00 a.m. every 1h Till 9:00 a.m.
State: Not Headset Plugged [Type: Any]
Enter: Speaking Clock (29)
A1: Secure Settings [Configuration: Screen & Keyboard Lights On
3 Seconds Package: com.intangibleobject.securesettings.plugin Name: Secure Settings Timeout (Seconds): 0]
A2: If [% SILENT ~ off]
A3: Music Play [File: Speaking Clock / music.mp3 Start: 0 Loop: Off Stream: 2] If [% SILENT ~ off]
A4: Wait [MS: 0 Seconds: 2 Minutes: 0 Hours: 0 Days: 0]
A5: Variable Split [Name:% TIME Splitter :. Delete Base: Off]
A6: Music Play [File: Speaking Clock / Hours /% TIME1.mp3 Start: 0 Loop: Off Stream: 2] If [% SILENT ~ off]
A9: End If

When the screen is off, the service freezes.
Runlog, had to cuckoo at 13:00
20150710 12.55.42 E Stop ID0: 0.0 TaskService
20150710 13.02.50 E Start ID0: 0.0 TaskService
20150710 13.02.59 E Stop ID0: 0.0 TaskService
20150710 03/13/25 M Restart ID0: 0.0 Monitor
Chyantd?

Post has been editedsergr59 - 10.07.15, 13:16



Rep: (6)
* username11, Hurray: the system tasker starts up regularly with every reboot and wake up! The main application problem has been resolved - I did not begin to pull pm enable and see what KingUser shows in the auto-launch settings.
There is one more little mystery: someone does not enable the Tasker Accessibility Service. In the system settings menu, the Accessibility Settings item is generally absent, when you enter it from the tasker in different ways, you can change OFF to ON, but when you exit and re-enter, we always see OFF ...



Rep: (2511)
* avgaz I think you, like everyone, have a conflict with the scene editor. Try resizing in xml.
Chyantd?

miui use. : D Greetings to the Chinese brothers with your rays of hatred. Look at miui settings where alarm is allowed there when the screen is off.

Post has been editedusername11 - 14.05.17, 18:36



Rep: (825)
* Marassa, Now when the tasker in your system situation can change
you can enable through settings or through secure settings
to start
settings get secure enabled_accessiblity_services
in the terminal from under the root
if empty then
settings put secure enabled_accessiblity_services net.dinglisch.android.tasker / net.dinglisch.android.tasker.MyAccessiblityServices
(you can shoot after waking up if you suddenly knock it out)

Post has been editedusername11 - 14.05.17, 18:37
Reason for editing: merged posts



Rep: (4)
Hello.
The device is Sony Z1C 4.4.4, a tasker has been added to stamina exceptions, polling of sensors when the screen is off is on.
The problem is this: there is a profile in which, when an incoming call is shaken left-right, the call is rejected, but it does not always work if the phone lies with the screen off. Also, the call reception by the proximity sensor and the vertical orientation does not always work.
Maybe you can somehow forcefully interrogate the sensors in the input task, since they are sleeping?
Profile: Call handling (9)
Restore: no
State: Call [Type: Incoming Number: *]
Enter: Call - start handling (16)
A1: Variable Set [Name:% CALL_STATE To:% CALL_RINGING Do Maths: Off Append: Off]
A2: Profile Status [Name: Call - test sensor Set: On]
A3: Profile Status [Name: Call - answer Set: Off]
A4: Profile Status [Name: Call - reject Set: On]
A5: Profile Status [Name: Call - test orientation Set: On]
A6: Profile Status [Name: Call - ringer off Set: Off]

Exit: Call - finish handling (17)
A1: Variable Set [Name:% CALL_STATE To:% CALL_OFF Do Maths: Off Append: Off]
A2: Profile Status [Name: Call - test sensor Set: Off]
A3: Profile Status [Name: Call - answer Set: Off]
A4: Profile Status [Name: Call - reject Set: Off]
A5: Profile Status [Name: Call - test orientation Set: Off]
A6: Profile Status [Name: Call - ringer off Set: Off]

Profile: Call - test sensor (10)
Restore: no Notification: no
State: Variable Value [% CALL_STATE eq% CALL_RINGING]
State: Not Proximity Sensor
Enter: Call - test sensor (18)
A1: Wait [MS: 0 Seconds: 3 Minutes: 0 Hours: 0 Days: 0]
A2: Profile Status [Name: Call - test sensor Set: Off]
A3: Profile Status [Name: Call - answer Set: On]

Profile: Call - answer (11)
Restore: no Notification: no
State: Variable Value [% CALL_STATE ~% CALL_RINGING /% CALL_MUTED]
State: Orientation [Is: Standing Up]
State: Proximity Sensor
Enter: Call - answer (19)
A1: Take Call
A2: Variable Set [Name:% CALL_STATE To:% CALL_SPEAKING Do Maths: Off Append: Off]

Profile: Call - reject (12)
Restore: no Notification: no
State: Variable Value [% CALL_STATE ~% CALL_RINGING /% CALL_MUTED]
Event: Shake [Axis: Left-Right Sensitivity: Medium Duration: Medium]
Enter: Call - reject (20)
A1: End Call

Profile: Call - test orientation (13)
Restore: no Notification: no
State: Variable Value [% CALL_STATE eq% CALL_RINGING]
State: Not Orientation [Is: Face Down]
Enter: Call - test orientation (21)
A1: Wait [MS: 0 Seconds: 3 Minutes: 0 Hours: 0 Days: 0]
A2: Profile Status [Name: Call - test orientation Set: Off]
A3: Profile Status [Name: Call - ringer off Set: On]

Profile: Call - ringer off (14)
Notification: no
State: Variable Value [% CALL_STATE eq% CALL_RINGING]
State: Orientation [Is: Face Down]
State: Variable Value [% SILENT neq on]
Enter: Call - ringer off (22)
A1: Silent Mode [Mode: On]
A2: Variable Set [Name:% CALL_STATE To:% CALL_MUTED Do Maths: Off Append: Off]
A3: Wait Until [MS: 0 Seconds: 15 Minutes: 0 Hours: 0 Days: 0] If [% CALL_STATE eq% CALL_OFF]


Post has been editedusername11 - 14.05.17, 18:31
Reason for editing: merged posts



Rep: (137)
Enabling / Disabling Data Transfer Using an NFC Tag

I did not find instructions in the topic of how to make friends Tasker and NFC, so I decided to post this profile, it might come in handy for someone;)
For the profile to work, you need the Xposed Framework and the NFC LockscreenOff Enabler module (allows NFC to work when the screen is off).
Read more here:NFC Unlocking (based on NFCLockscreenOff Enabler)
profile
Procedure:
1. Get root rights.
2. Make sure that the phone has NFC and Android 4.1-4.4.
3. Install Xposed and the NFC LockscreenOff Enabler module. Install the framework, activate the module, restart the phone.
4. Turn on NFC.
5. Configure the NFC LockscreenOff Enabler module:
- in the item Enable NFC when we select the item screen is off
- check the Enabled tag lost message box (so that the Tasker knows when the tag is lost)
- Presence check timeout item is responsible for the scanning period (I left the default 2 seconds)
- in the item Authorized NFC tags, you can add tags that will unlock the phone (even without Tasker)
Attached Image
Attached Image

6. Set up a profile in Tasker:
- Intent Received event
- intent android.nfc.action.TAG_CHANGED
- in the profile task, you can use the variables% tag_uuid (tag id) and% tag_present (tag status, true or false)

Code:
Profile: NFC status (7)
Event: Intent Received [Action: android.nfc.action.TAG_CHANGED Cat: None Cat: None Scheme: * Mime Type: *]
Enter: Anon (11)
A1: Mobile Data [Set: On] If [% tag_uuid ~ 2BDF21B2 &% tag_present ~ true]
A2: Mobile Data [Set: Off] If [% tag_uuid ~ 2BDF21B2 &% tag_present ~ false]

2BDF21B2 is the id of my NFC tag

DOWNLOAD:Attached fileNFC_status.prf.xml.zip(604 bytes)

How to use a profile:
- put the phone on the NFC-tag = Internet ON
- remove the phone from the NFC tag = Internet OFF
- if you configured unlocking in NFC LockscreenOff Enabler, then the phone will unlock when off. screen.



Rep: (2511)
* star-trio too complicated - Tasker is stupid. It is necessary to remove all Profile Status actions, they are not needed at all. Replace them with appropriate contexts. Further, Call - test sensor (10), Call - test orientation (13) profiles: it is not a fact that in 3 seconds the sensor will be polled. However, they are also not needed. Start with a very simple profile:
state Variable Value% DEBUG_START_SENSOR ~ on
state proximity / not proximity
task% DEBUG_START_TIME =% TIMES or% TIMEMS

Using the% DEBUG_START_SENSOR variable, play with the profile when the screen is on, off with various settings for the period of polling sensors. In Run Log, see if Tasker is very dumb. Replace the bounding context with Call Incoming, repeat the observations. Put all the observations here.

Post has been editedusername11 - 21.05.17, 19:51



Rep: (842)
In a hat

Here I played with dumpsys telephony.registry pile a new profile for sims*

Profile: ShowScenaSim (54)
Event: Phone Ringing [Caller: C: ANY]
Enter: DumpSysSim (89)
A1: Perform Task [Name: Color of Priority Bar:% priority Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable: Stop: Off]
A2: Run Shell [Command: dumpsys telephony.registry Timeout (Seconds): 0 Use Root: On Store Output In:% DumpSim1 Store Errors In: Store Result In:]
A3: Variable Search Replace [Variable:% DumpSim1 Search: mCallState = 1 Ignore Case: Off Multi-Line: Off One Match Only: Off Store Matches In:% Dump1 Replace Matches: Off Replace With: 1]
A4: If [% Dump11 ~ mCallState = 1]
A5: Variable Set [Name:% SIM To: 1 Do Maths: Off Append: Off]
A6: Perform Task [Name: Sim_Num_scene1 Priority:% priority Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable: Stop: Off]
A7: End If
A8: Stop [With Error: Off Task:] If [% Dump11 ~ mCallState = 1]
A9: Run Shell [Command: dumpsys telephony.registry2 Timeout (Seconds): 0 Use Root: On Store Output In:% DumpSim2 Store Errors In: Store Result In:]
A10: Variable Search Replace [Variable:% DumpSim2 Search: mCallState = 1 Ignore Case: Off Multi-Line: Off One Match Only: Off Store Matches In:% Dump2 Replace Matches: Off Replace With:]
A11: If [% Dump21 ~ mCallState = 1]
A12: Variable Set [Name:% SIM To: 2 Do Maths: Off Append: Off] If [% Dump21 ~ mCallState = 1]
A13: Perform Task [Name: Sim_Num_scene2 Priority:% priority Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable: Stop: Off]
A14: End If

Sim_Num_scene1 (87)
Run both together
A1: Wait [MS: 0 Seconds: 1 Minutes: 0 Hours: 0 Days: 0]
<Setting the color of sim1>
A2: Variable Set [Name:% Color To:% Color1 Do Maths: Off Append: Off]
A3: Test Scene [Name: IncallNameBig Test: Status Store Result In:% IncallName]
A4: Show Scene [Name: IncallNameBig Display As: Overlay, Blocking Horizontal Position: 200 Vertical Position: 9 Animation: None Show Exit Button: On Continue Task Immediately: On] If [% IncallName! ~ Visible]

Sim_Num_scene2 (136)
Run both together
A1: Wait [MS: 0 Seconds: 1 Minutes: 0 Hours: 0 Days: 0]
A2: Variable Set [Name:% Color To:% Color2 Do Maths: Off Append: Off]
A3: Test Scene [Name: IncallNameBig Test: Status Store Result In:% IncallName]
A4: Show Scene [Name: IncallNameBig Display As: Overlay, Blocking Horizontal Position: 200 Vertical Position: 9 Animation: None Show Exit Button: On Continue Task Immediately: On] If [% IncallName! ~ Visible]


Task: Color Stripes (224)
<green strip>
A1: Variable Set [Name:% Color1 To: # FF5FC46F Do Maths: Off Append: Off]
<strip orange>
A2: Variable Set [Name:% Color2 To: # FFE5583F Do Maths: Off Append: Off]

Profile: ClearAfterCall (177)
State: Variable Value [% SIM> 0 ]
Event: Phone Idle
Enter: ClearAfterCall (291)
A1: Variable Set [Name:% SIM To: 0 Do Maths: Off Append: Off]
A2: Destroy Scene [Name: IncallNameBig]
A3: Destroy Scene [Name: Incall Wrong]
A4: Array Clear [Name:% Dump]
A5: Array Clear [Name:% DumpSim]

Profile: Incall Not Corrected 1 Life (159)
State: Call [Type: Incoming Number:! + 38063 * / + 38073 * / + 38093 *]
State: Variable Value [% SIM ~ 1]
Enter: Attention (156)
A1: Show Scene [Name: Incall Wrong Display As: Overlay, Blocking Horizontal Position: 100 Vertical Position: 52 Animation: System Show Exit Button: On Continue Task Immediately: On]

Profile: Incall Not Corrected 2 MTS (160)
State: Call [Type: Incoming Number:! + 38050 * / + 38066 * / + 38095 * / + 38099 *]
State: Variable Value [% SIM ~ 2]
Enter: Attention (156)
A1: Show Scene [Name: Incall Wrong Display As: Overlay, Blocking Horizontal Position: 100 Vertical Position: 52 Animation: System Show Exit Button: On Continue Task Immediately: On]

Scenes
Scene: Incall Wrong
P: 720x140 L: -1x-1

Orientation: System
Background Color: # 00FFFFFF
Action Bar Style: System
Title: Incall Wrong
Subtitle:
Icon: null
Tab Labels:

Element: Text1 / Text
Geometry:
P: 0.0 720x140 L: 0.0 720x140
Content:
Text: ATTENTION !!!
Check Operator
Text Size: 18
Text Width Scale Percent: 100
Text Color: #FFFFFFFF
Font:
Position: Center
Vertical Fit Mode: None
Text Format: Plain Text
Scene: IncallNameBig
P: 720x216 L: -1x-1

Orientation: System
Background Color:% Color
Action Bar Style: System
Title: SIM
Subtitle:
Icon: null
Tab Labels:

Element: Name / Text
Geometry:
P: 0,0 540x145 L: 0,0 539x144
Content:
Text:% CNAME
Text Size: 24
Text Width Scale Percent: 100
Text Color: #FFFFFFFF
Font:
Position: Top Left
Vertical Fit Mode: None
Text Format: Plain Text

Element: Number / Text
Geometry:
P: 0.144 720x72 L: 0.108 539x72
Content:
Text:% CNUM
Text Size: 15
Text Width Scale Percent: 155
Text Color: # FF1D10EB
Font:
Position: Center
Vertical Fit Mode: None
Text Format: Plain Text

Element: Sim / Text
Geometry:
P: 540.0 180x144 L: 540.0 179x144
Content:
Text:% SIM
Text Size: 45
Text Width Scale Percent: 150
Text Color: #FFFFFFFF
Font:
Position: Center
Vertical Fit Mode: None
Text Format: Plain Text


Attached fileSIM_NUM_Incall.prj.xml(20.96 KB)

other performance, quicker
Profile: IncallSimNumD (54)
Priority: 7 Enforce: no
State: Call [Type: Incoming Number: *]
Enter: InDumpSim (154)
A1: Run Shell [Command: (dumpsys telephony.registry && dumpsys telephony.registry2) | grep -wo mCallState = '. *' Timeout (Seconds): 0 Use Root: On Store Output In:% SIM Store Errors In: Store Result In:]
A2: Perform Task [Name: IN1 Priority:% priority Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable: Stop: Off] If [% SIM ~ mCallState = 1
mCallState = 0]
A3: Perform Task [Name: IN2 Priority:% priority Parameter 1 (% par1): Parameter 2 (% par2): Return Value Variable: Stop: Off] If [% SIM ~ mCallState = 0
mCallState = 1]

Exit: ClearAfterCallDestroy (353)
A1: Destroy Scene [Name: NameNumSim Continue Task After Error: On]
A2: Destroy Scene [Name: NameNumSimOut Continue Task After Error: On]
A3: Destroy Scene [Name: Incall Wrong Continue Task After Error: On]
A4: Variable Clear [Name:% Sim Pattern Matching: Off]
A5: Variable Clear [Name:% SIM Pattern Matching: Off]
A6: Variable Clear [Name:% SIM1 Pattern Matching: Off]
A7: Variable Clear [Name:% SIM2 Pattern Matching: Off]



Post has been editedusername11 - 30.07.17, 12:05
Reason for editing: complex MCI refers to this post 17



Rep: (585)
In a hat

The profiles below are examples to demonstrate the principles and methods of working with Tasker. They are not time-tested, but at the same time they are workable and checked for the correct operation of contexts and the sequence of tasks.
###
miscellanea
Flashlight on JF
So, in our casino arrived. In order not to litter the minds with a second explanation, the main posthere, and here we hang the buns.
Task torch with types
Abort Existing Task
A1: JF mCamera = android.hardware.Camera.open () Continue Task After Error: On
A2: JF mParams = mCamera.getParameters () Continue Task After Error: On
A3: If% err eq 1
A4: Popup Text: Failed to connect to the camera.
A5: Stop
A6: End If
A7: JF% mode = mParams.getFlashMode ()
A8: JF mParams.setFlashMode (torch) If% mode! ~ Torch
Up to this point, the task goes unchanged. And then we call the scene to select the type of flashlight: just a torch, flasher (flash) and SOS. The designer of me is not ah, andas a child I did not obey my grandmotherI did not follow the advice of You-Know-Who (rather, just out of laziness, because for me this is not (!) important yet), but I still present my craft for review, and immediately for import. Of the viruses in it, only actions by clicking on special areas that change the visibility of points showing the choice, set the% type variable to the appropriate value and destroy the scene after the selection.
Scene select_type
Visually
Attached Image
Attached fileselect_type.scn.xml.zip(8.99 KB)
Remove extension .zip
Restangle elements 31, 32, 33 contain something like this
for tap
A1: Element Visibility Scene Name: select_type Element Match: Image1 Set: True Animation Time (MS): 0
A2: Element Visibility Scene Name: select_type Element Match: Image2 Set: False Animation Time (MS): 0
A3: Element Visibility Scene Name: select_type Element Match: Image3 Set: False Animation Time (MS): 0
A4: Wait MS: 0 Seconds: 1
A5: Variable Set Name:% type To: torch
A6: Destroy Scene Name: select_type
A10 or Camera.setParameters (CameraParameters.setFlashMode (off), as we see, is again out of work.
Depending on the value of% type, we end up in one of the infinite loops, which can only be stopped by restarting the task. Flash cycle - turning the bulb on and off with an interval of 1 second.
A9: Show Scene Name: select_type Display As: Dialog Horizontal Position: 100 Vertical Position: 100 Animation: System Show Exit Button: Off Continue Task Immediately: Off If% mode! ~ Torch
A10: [X] JF mParams.setFlashMode (off) If% mode ~ torch
A11: JF mCamera.setParameters (mParams)
A12: If% type ~ flash
<loop flash>
A13: JF mCamera.startPreview ()
A14: Wait Seconds: 1
A15: JF mCamera.stopPreview ()
A16: Wait Seconds: 1
A17: Goto Label: loop flash
A18: End If
The sos cycle speaks for itself (by the way, sos are not letters at all, but a sequence of 9 signals, broken down into letters for the convenience of remembering). First For<loop sos>sets the order and duration of the signal (1, 6, 1) x100ms (in general, the duration of a long signal (dash -) should be 2 times longer than a short one (dot.), but since the wireless telegraphist from the flashlight as of me is a designer, I had to increase the duration of the dash in 3 times for the relative intelligibility of this sos). Second For<loop 3>turns the flashlight on and off 3 times with the desired signal duration (cm<loop sos>)
A19: If% type ~ sos
<loop sos>
A20: For Variable:% item Items: 1,6,1
A21: Variable Set Name:% wait To: 100 *% item Do Maths: On Append: Off
<loop 3>
A22: For Variable:% beep Items: 1: 3
A23: JF mCamera.startPreview ()
A24: Wait MS:% wait
A25: JF mCamera.stopPreview ()
A26: Wait MS: 200
A27: End For
A28: End For
A29: Wait Seconds: 2
A30: Goto Label: loop sos
A31: End If
Well, turn off the flashlight or put it on the timer
A32: Wait Minutes: 3 If% mode! ~ Torch
A33: JF = mCamera.release ()

This mysterious svc
Svc.java
svc, which has recently been popular for turning mobile data on and off, is still a simple and probably equally mysterious trick for some. So who is he, this Mr. svc?
svc is an Android command line utility that allows you to control the state of some interfaces.
If you enter the svc command in the terminal, then with the naked eye you can see three ... no, four, and sometimes fivestarsavailable teams.
Available commands:
power
Control the power managerPowerCommand.java
The first command, as the name implies, allows you to control some power settings.
Leave / not leave the screen on for a certain type of power
svc power stayon [true | false | usb | ac | wireless] Set the "keep awake while plugged in" setting
in java
/**
* "false" val = 0;
* "usb" val = BatteryManager.BATTERY_PLUGGED_USB;
* "ac" val = BatteryManager.BATTERY_PLUGGED_AC;
* "wireless" val = BatteryManager.BATTERY_PLUGGED_WIRELESS;
*/
IPowerManager pm = IPowerManager.Stub.asInterface (ServiceManager.getService (Context.POWER_SERVICE));
pm.setStayOnSetting (val);

Reboot without confirmation. reason - code for loading in a special mode, for example, recovery; if not specified, a simple reboot.
svc power reboot [reason] Perform a runtime shutdown and reboot device with specified reason
in java
/**
* "reboot"
* no confirm, wait till device is rebooted
* reason code to pass to the kernel (e.g., "recovery") to request special boot modes, or null
*/
pm.reboot (false, mode, true);

Turning off the phone without confirmation
svc power shutdown Perform a runtime shutdown and power off the device
in java
/**
* "shutdown"
* no confirm, wait till device is off
*/
pm.shutdown (false, null, true);

data
Control mobile data connectivityDataCommand.java
Mobile data management - enable or disable
svc data [enable / disable] Turn mobile data on or off
in java
phoneMgr = ITelephony.Stub.asInterface (ServiceManager.getService (Context.TELEPHONY_SERVICE));
phoneMgr.enableDataConnectivity ();
phoneMgr.disableDataConnectivity ();

Set mobdata as the preferred type of data network.
svc data prefer Set mobile as the preferred data network
in java
connMgr = IConnectivityManager.Stub.asInterface (ServiceManager.getService (Context.CONNECTIVITY_SERVICE));
connMgr.setNetworkPreference (ConnectivityManager.TYPE_MOBILE);

wifi
Control the wifi managerWificommand.java
Turn on / off WiFi
svc wifi [enable / disable] Turn Wi-Fi on or off
in java
IWifiManager.Stub.asInterface (ServiceManager.getService (Context.WIFI_SERVICE));
wifiMgr.setWifiEnabled (flag);

Set WiFi as your preferred type of data network
svc wifi prefer Set Wi-Fi as the preferred data network
in java
IConnectivityManager connMgr = IConnectivityManager.Stub.asInterface (ServiceManager.getService (Context.CONNECTIVITY_SERVICE));
connMgr.setNetworkPreference (ConnectivityManager.TYPE_WIFI);

usb
Control usb stateUsbCommand.java
Enable function for USB connection.
svc usb setFunction [function] Set the current usb function

Get a list of included features for a USB connection.
svc usb getFunction Gets the list of currently enabled function
in java
/**
* List USB Function fromUsbManager.java
* USB_FUNCTION_MASS_STORAGE = "mass_storage"
* USB_FUNCTION_ADB = "adb";
* USB_FUNCTION_RNDIS = "rndis";
* USB_FUNCTION_MTP = "mtp";
* USB_FUNCTION_PTP = "ptp";
* USB_FUNCTION_AUDIO_SOURCE = "audio_source";
* USB_FUNCTION_ACCESSORY = "accessory";
* More values ​​from my firmware
* USB_FUNCTION_ACM = "acm";
* USB_FUNCTION_DUAL_ACM = "dual_acm"
* USB_FUNCTION_CHARGING_ONLY = "charging"
* USB_FUNCTION_BICR = "bicr"
* USB_FUNCTION_EEM = "eem"
* USB_FUNCTION_VIA_CDROM = "via_cdrom_storage"
*/
IUsbManager usbMgr = IUsbManager.Stub.asInterface (ServiceManager.getService (Context.USB_SERVICE));
usbMgr.setCurrentFunction (String function);
usbMgr.getDefaultFunction ()

nfc
Control nfc functionsNfcCommand.java
Turn on / off NFC
svc nfc [enable | disable] Turn NFC on or off
in java
INfcAdapter nfc = INfcAdapter.Stub .asInterface (ServiceManager.getService (Context.NFC_SERVICE));
nfc.enable ();
nfc.disable (true)

The note gives links to the sources of the corresponding classes, the java code in the spoilers is brutally mutilated in order to show only the basic methods.

Java Function tricks
Here are some tricks for working with JF. There may be inaccuracies in terms, but as they say, no one canceled the discussion
1. Getting a service
Or, rather, a manager for this service.
You can see the list of services by executing the service list command in the terminal. At the output, we get the service_name: [interface_class_to_service_data_manager]
service list output example
Found 95 services:
0 sip: [android.net.sip.ISipService]
1 phoneEx: [com.mediatek.common.telephony.ITelephonyEx]
2 phone: [com.android.internal.telephony.ITelephony]
3 iphonesubinfo2: [com.android.internal.telephony.IPhoneSubInfo]
4 simphonebook2: [com.android.internal.telephony.IIccPhoneBook]
5 isms2: [com.android.internal.telephony.ISms]
6 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
7 simphonebook: [com.android.internal.telephony.IIccPhoneBook]
8 isms: [com.android.internal.telephony.ISms]
9 media_router: [android.media.IMediaRouterService]
10 print: [android.print.IPrintManager] ...
In JF, the service manager can be obtained either by selecting from the list Class or Object by clicking on MagnificGlass (MG)
A1 JF (<Service>Manager) myManager =<Service>Manager.new (Context CONTEXT)
either in the following way (it is described in UserGuide):
A1 JF (<Service>Manager) myManager = CONTEXT.getSystemService (String service_name)
A2 JF myManager.methodToInvoke ()
Now we have access to the methods of this manager
2. Getting the hidden method
Some methods are hidden and therefore may not appear in the list of methods for MG, but if you know that "there is still a gopher," you can use the following method:
A1 JF (<Service>Manager) myManager = CONTEXT.getSystemService (service_name)
A2 JF clManager = myManager.getClass ()
A3 JF myMethod = clManager.getDeclaredMethod (String methodToInvoke, null)
A4 JF myMethod.setAccessible (true)
A5 JF myMethod.invoke (myManager, null)

3. Getting Android's Inner Class
We won’t find these classes in the Class or Object list for MG, but we looked at the Android sources beforehand and we know that they are there, and we’re afraid of them as needed. What to do? Just call. By name.
// In the parameters we write the path to the desired class.
A1 JF myClass = Class.forName (String path.to.Class)
or
A1 clLoader = CONTEXT.getClassLoader ()
// In the parameters we write the path to the desired class.
A2 myClass = clLoader.loadClass (String path.to.Class)
// newInstance for use in myClass.methodToInvoke.invoke (Object, Object [])
A3 myObject = myClass.newInstance ()

4 Obtaining a method with parameters
In method 2, the preparation of a method without parameters was considered. To get a method with parameters, you need to pass these parameters in the required form: getDeclaredMethod (String method_name, Class [] param). To do this, create an array with parameter classes. Arrays in java start from zero (0).
// class name something like com.android.blabla.Class
A1 JF myClass = Class.forName (String path.to.Class)
// n - number of parameters
A2 JF param = Class []. New (n)
A3 JF param [0] = "param1" .getClass ()
A4 JF param [n] = "paramn" .getClass ()
A5 JF myMethod = clManager.getDeclaredMethod (methodToInvoke, param)
A6 JF myMethod.setAccessible (true)
// Pass parameters to the method
A7 JF args = Object []. New (n)
A8 JF args [0] = "param1"
A9 JF args [n] = "paramn"
A10 JF myMethod.invoke (Object, Object [] args)

5 Obtaining a method with "unsupported" parameters
Class cannot be obtained for some parameters, because these are primitive types of data such as byte, short, int, long, float, double, boolean and char. I called them unsupported because they cannot be substituted into the Class [] array to get the method using getDeclaredMethod ().
Lyrical digression - what Pent does not know
Actually, this technique made me take up the pen, since even Pent itself does not know about this method yet. At least I'm nothing moreof this
Pent
p.s. I used getClass () on an int to get Integer.class, but as I said, I believe Integer.TYPE is necessary and not supported in Tasker if I remember right, therefore waiting till private methods can be selected is probably best. Pent
I did not find a tasker on the forum. But* Sami_Kto_Kto He knows, and told me about it, but I share with everyone.
To get such a method, you need to get a list of all the methods of the class and select from the array the number you need.
// n - serial number of the method, m - number of parameters
A1 JF myClass = Class.forName (String path.to.Class)
A2 JF methods = clManager.getDeclaredMethods ()
A3 JF methods [n] .setAccessible (true)
A4 JF args = Object []. New (m)
A5 JF args [0] = 1.intValue ()
A6 JF args [m] = true.booleanValue ()
A7 JF methods [n] .invoke (Object, Object [] args)
Just how to peel mandarin.
6 Getting a list of class methods
Methods can be calculated manually (starting from 0), or you can use the following task:
getDeclaredMethods
// Our account
A1: Variable Set Name:% count To: 0
// in the To: field, press enter and get a new empty line for readability of the list
A2: Variable Set Name:% enter To:
A3: Variable Set Name:% aclass To: android.blabla.MyClass
A4: JF aClass = Class.forName (% aclass)
A5: JF items = aClass Function: getDeclaredMethods ()
A6: For% item Items: items
A7: Write File File:% aclass methods.txt Text:% count% item% enter Append: On Add Newline: On
A8: Variable Set Name:% count To:% count + 1 Do Maths: On
A9: End For
As a result, in the root of sdcard we get the file android.blabla.MyClass methods.txt with a numbered list of methods.
7 Getting TRANSACTION from $ Stub files
getDeclaredFieds
// To: enter - empty string
A1: Variable Set% enter To:
A2: Variable Set% aclass To: com.android.blabla.IClass $ Stub
A3: JF aClass = Class.forName (% aclass)
A4: JF items = aClass.getDeclaredFields ()
A5: For% item Items: items
/**
* In this way, you can also try to get fields and their values ​​of any class
* The search pattern looks for a string like static final int com.android.internal.telephony.ITelephony $ Stub.TRANSACTION_dial
* or public static final int android.media.AudioSystem.DEVICE_OUT_HEADSET for other classes.
* Can be used as a template ([^ \.] + $), That is, "characters at the end of the line after the period", do not Replace and use% item1 in A7 and A10
*/
A6: Variable Search Replace Variable:% item Search: ([^] * \ s) {1,} ([^] * \.) {1,} ([^ \.] + $) Store Matches In:% item Replace Matches: On Replace With: $ 3
A7: JF field = aClass.getDeclaredField (% item)
A8: JF field.setAccessible (true)
A9: JF% code = field.get ()
A10: Write File File:% aclass fields.txt Text:% item =% code% enter Append: On Add Newline: On
A11: End For
To be continued ...

AudioSystem - from headphone to speaker
The goal is to switch the audio stream in FMRadio from headphone to speaker . We use android.media.AudioSystem , android.media.AudioService , Audiomanager and JF.
Discussion Tasker (Post username11 # 49232340) , Tasker (Post slax # 49276265) , Tasker (Post username11 # 49315940) , Tasker (Post slax # 49318798), Tasker (Post username11 # 49366804) .
The laid out tasks were checked on DualSIM MTK AOSP 4.4.2 (maybe on other devices there will be slightly different results - try it), the links to the sources are given as an example, in my firmware they are slightly different, but the main points are the same.
AudioManager.setWiredDeviceConnectionState (int device, int state, String name)
The option is based on sending a command to disconnect the headphones, the output of the stream automatically switches to the speaker.
List of output devices from AudioSystem.java
// output devices, be sure to update AudioManager.java also
public static final int DEVICE_OUT_EARPIECE = 0x1;
public static final int DEVICE_OUT_SPEAKER = 0x2;
public static final int DEVICE_OUT_WIRED_HEADSET = 0x4;
public static final int DEVICE_OUT_WIRED_HEADPHONE = 0x8;
public static final int DEVICE_OUT_BLUETOOTH_SCO = 0x10;
public static final int DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20;
public static final int DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40;
public static final int DEVICE_OUT_BLUETOOTH_A2DP = 0x80;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200;
public static final int DEVICE_OUT_AUX_DIGITAL = 0x400;
public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800;
public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000;
public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000;
public static final int DEVICE_OUT_USB_DEVICE = 0x4000;
public static final int DEVICE_OUT_REMOTE_SUBMIX = 0x8000;

// device states, must match AudioSystem :: device_connection_state
public static final int DEVICE_STATE_UNAVAILABLE = 0;
public static final int DEVICE_STATE_AVAILABLE = 1;

public static final String DEVICE_OUT_EARPIECE_NAME = "earpiece";
public static final String DEVICE_OUT_SPEAKER_NAME = "speaker";
public static final String DEVICE_OUT_WIRED_HEADSET_NAME = "headset";
public static final String DEVICE_OUT_WIRED_HEADPHONE_NAME = "headphone";
public static final String DEVICE_OUT_BLUETOOTH_SCO_NAME = "bt_sco";
public static final String DEVICE_OUT_BLUETOOTH_SCO_HEADSET_NAME = "bt_sco_hs";
public static final String DEVICE_OUT_BLUETOOTH_SCO_CARKIT_NAME = "bt_sco_carkit";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_NAME = "bt_a2dp";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES_NAME = "bt_a2dp_hp";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER_NAME = "bt_a2dp_spk";
public static final String DEVICE_OUT_AUX_DIGITAL_NAME = "aux_digital";
public static final String DEVICE_OUT_ANLG_DOCK_HEADSET_NAME = "analog_dock";
public static final String DEVICE_OUT_DGTL_DOCK_HEADSET_NAME = "digital_dock";
public static final String DEVICE_OUT_USB_ACCESSORY_NAME = "usb_accessory";
public static final String DEVICE_OUT_USB_DEVICE_NAME = "usb_device";
public static final String DEVICE_OUT_REMOTE_SUBMIX_NAME = "remote_submix";
Task
// Get the AudioSystem class
A1 JF clAudiosys = Class.forName (android.media.AudioSystem)
// Get field values ​​from AudioSystem for headphones
A2 JF field = clAudiosys.getDeclaredField (DEVICE_OUT_WIRED_HEADPHONE)
A3 JF aDevice = field.get ()
A4 JF field = clAudiosys.getDeclaredField (DEVICE_STATE_UNAVAILABLE / DEVICE_STATE_AVAILABLE)
A5 JF aState = field.get ()
A6 JF aField = clAudiosys.getDeclaredField (DEVICE_OUT_WIRED_HEADPHONE_NAME)
A7 JF aName = aField.get ()
// Get AudioManager and method AudioManager.setWiredDeviceConnectionState (int device, int state, String name)
// This method is also available from AudioService, and in IAudioService $ Stub you can find the TRANSACTION code for service call audio
A8 JF aAudioman = new.AudioManager (CONTEXT)
A9 JF aAudioman.setWiredDeviceConnectionState (aDevice, aState, aName)
// After switching to the speaker, playback is paused, so we start from the stop point (for a standard player)
A10 Media Control Cmd: Play (Simulated Only)
This is a draft, moreover, it does not work with my radio. It is simply cut down, realizing the disconnection of the headphone antenna. Apparently there is no short antenna in my device, and if I pull out the headphones and send a request to connect them, and then put the sound out of the application to the speaker, only white noise is heard. To whom it is, but it does not suit me. And there is no JF miracle in this task.
Conclusion: the task is half completed

AudioSystem.setDeviceConnectionState (int device, int state, String device_address)
This option is already better, although it is based on the same principle. It uses a JF trick to get the method not by name, but by its number from the getDeclaredMethods () array. Let me remind you that arrays in java start with 0. My method number is 25. The device_address parameter for a wired headset is optional, so we only set device and state
Task
A1: JF clAudiosys = Class.forName (android.media.AudioSystem)
A2: JF aAudmethod = clAudiosys.getDeclaredMethods ()
A3: JF aAudmethod [25] .setAccessible (true)
A4: JF args = Object []. New (3)
A5: JF field = clAudiosys.getDeclaredField (DEVICE_OUT_WIRED_HEADSET)
A6: JF args [0] = field.get ()
A7: JF field = clAudiosys.getDeclaredField (DEVICE_STATE_UNAVAILABLE / DEVICE_STATE_AVAILABLE)
A8: JF args [1] = field.get ()
A9: JF aAudmethod [25] .invoke (clAudiosys, args)
The sound is redirected to the speaker for both the radio and the player, playback is not paused, BUT. If now I open the FMRadio window (so it may be different with other devices), and then minimize it, the radio flies out, realizing that it was again deceived with the antenna. And further. After completing this task, to turn on the radio, you will either need to perform the inverse task (DEVICE_STATE_AVAILABLE), or remove and insert the headphones.
Conclusion: suitable for switching when playing in the player

AudioSystem.setForceUse (int usage, int config)
The next option is based on forcing the flow to the speaker
AudioSystem.java, config & usage for setForceUse ()
// device categories config for setForceUse, must match AudioSystem :: forced_config
public static final int FORCE_NONE = 0;
public static final int FORCE_SPEAKER = 1;
public static final int FORCE_HEADPHONES = 2;
public static final int FORCE_BT_SCO = 3;
public static final int FORCE_BT_A2DP = 4;
public static final int FORCE_WIRED_ACCESSORY = 5;
public static final int FORCE_BT_CAR_DOCK = 6;
public static final int FORCE_BT_DESK_DOCK = 7;
public static final int FORCE_ANALOG_DOCK = 8;
public static final int FORCE_DIGITAL_DOCK = 9;
public static final int FORCE_NO_BT_A2DP = 10;
public static final int FORCE_SYSTEM_ENFORCED = 11;
private static final int NUM_FORCE_CONFIG = 12;
public static final int FORCE_DEFAULT = FORCE_NONE;

// usage for setForceUse, must match AudioSystem :: force_use
public static final int FOR_COMMUNICATION = 0;
public static final int FOR_MEDIA = 1;
public static final int FOR_RECORD = 2;
public static final int FOR_DOCK = 3;
public static final int FOR_SYSTEM = 4;
private static final int NUM_FORCE_USE = 5;
Here again, we use the trick to get the method by number.
Task

A1: JF clAudiosys = Class.forName (android.media.AudioSystem)
A2: JF aAudmethod = clAudiosys.getDeclaredMethods ()
A3: JF args = Object []. New (2)
A4: JF usage = clAudiosys.getDeclaredField (FOR_MEDIA)
A5: JF config = clAudiosys.getDeclaredField (FORCE_SPEAKER)
A6: [X] JF args [0] = 5.intValue ()
A7: JF args [0] = usage.get ()
A8: JF args [1] = config.get ()
A9: JF aAudmethod [28] .setAccessible (true)
A10: JF aAudmethod [28] .invoke (clAudiosys, args)
Perhaps someone will work with FMRadio. It didn’t work for me at all. From what? Indeed, in the sources of FMRadio it is seen that switching to the speaker from the menu uses the AudioSystem.setForceUse method. We look carefully at the sourceFMRadio
FmService.java
private static final int FOR_PROPRIETARY = 1;

private void setForceUse (boolean isSpeaker) {
mForcedUseForMedia = isSpeaker? AudioSystem.FORCE_SPEAKER: AudioSystem.FORCE_NONE;
AudioSystem.setForceUse (FOR_PROPRIETARY, mForcedUseForMedia);
mIsSpeakerUsed = isSpeaker;
FmService.java from Mediatek
// must check AudioSystem.usage when google upgrade
private static final int FOR_PROPRIETARY = 5;

public void setSpeakerPhoneOn (boolean isSpeaker) {
LogUtils.d (TAG, ">>>FMRadioService.useSpeaker: "+ isSpeaker);
mForcedUseForMedia = isSpeaker? AudioSystem.FORCE_SPEAKER: AudioSystem.FORCE_NONE;
AudioSystem.setForceUse (FOR_PROPRIETARY, mForcedUseForMedia);
mIsSpeakerUsed = isSpeaker;
LogUtils.d (TAG, "<<<FMRadioService.useSpeaker ");
Yeah, so for usage, you should use not FOR_MEDIA, but FOR_PROPRIETARY. In the first case, the values ​​of FOR_MEDIA and FOR_PROPRIETARY are the same and nothing needs to be changed, and in the second, since there is no such field in the AudioSystem, I just substituted the desired value (in the task, the action A6 is turned off). Now the radio can be switched to the speaker with a tasker. Switch back to the headphones via the menu with two clicks, because the value of this menu item is not updated. Or perform the inverse task in the tasker.
Conclusion: The goal is achieved.
Not finalized: work with the player

For a snack: the correct killing of the FMRadio service (aka Pressing the shutdown button in the application)
for mediatek
Send Intent Action: com.mediatek.FMRadio.FMRadioService.ACTION_TOFMSERVICE_POWERDOWN

Intents
ACTION_AUDIO_BECOMING_NOISY
Added in API level 3
String ACTION_AUDIO_BECOMING_NOISY
Broadcast intent, a hint for applications that audio is about to become 'noisy' due to a change in audio outputs. For example, this intent may be sent when a wired headset is unplugged, or when an A2DP audio sink is disconnected, and the audio system is about to automatically switch audio route to the speaker. Applications that are controlling audio streams may consider pausing, reducing volume or some other action on receipt of this intent so as not to surprise the user with audio from the speaker.
Constant Value: "android.media.AUDIO_BECOMING_NOISY"

ACTION_HEADSET_PLUG
Added in API level 21
String ACTION_HEADSET_PLUG
Broadcast Action: Wired Headset plugged in or unplugged. You cannot receive this through components declared in manifests, only by explicitly registering for it with Context.registerReceiver ().
The intent will have the following extra values:
state - 0 for unplugged, 1 for plugged.
name - Headset type, human readable string
microphone - 1 if headset has a microphone, 0 otherwise
Constant Value: "android.intent.action.HEADSET_PLUG"

Statusbar
Show or hide the alarm icon in the status bar
Pre-lollipop
Send Intent Action: android.intent.action.ALARM_CHANGED Extra: setAlarm: true / false
or
A1 JF myIntent = new Intent (android.intent.action.ALARM_CHANGED)
A2 JF myIntent = myIntent.putExtra (alarmSet, false / true)
A3 JF CONTEXT.sendBroadcast (myIntent)
Intent hides the icon until the Clock application starts
Gravitybox
Send Intent Action: gravitybox.intent.action.CENTER_CLOCK_CHANGED Extra: alarmHide: true / false
A hidden icon skips briefly when the Clock application starts
Here we use the IStatusBarService.setIconVisibility (String, boolean) method, which in JF could be represented as
A1 JF aStatusbar = CONTEXT.getSystemService (statusbar)
A2 JF aStatusbar.setIconVisibility (alarm_clock, true / false)
but
SecurityException
Neither user 10114 nor current process has android.permission.STATUS_BAR
so we will go the other way
Use root
service call statusbar TRANSACTION_CODE s16 alarm_clock i32 0/1
The TRANSACTION code can be found in com.android.internal.statusbar.IStatusBarService $ Stub.
Other icons
Attached Image

You can see the names of the icons to hide / showhere(adjusted for your version of Android) or in SystemUI.apk com / android / systemui / statusbar / phone / PhoneStatusBarPolicy.smali. I have it sync_active, bluetooth, headset, tty, volume, cdma_eri and alarm_clock

Open / close the notification panel or settings
A1 JF aStatusbar = CONTEXT.getSystemService (statusbar)
// Open the notification panel
A2 JF aStatusbar.expandNotificationsPanel ()
// Open the settings panel
A3 JF aStatusbar.expandSettingsPanel ()
// Collapse panels
A4 JF aStatusbar.collapsePanels ()


Defining a geolocation mode
To determine the location in the Android uses the following providers: NETWORK_PROVIDER, GPS_PROVIDER, PASSIVE_PROVIDER and FUSED_PROVIDER. Fused combines data from all possible sources to determine the best location. The problem is not in use. Passive allows you to receive location updates for other programs or services without a real request, it returns the value provided by other providers. I have not figured out whether to turn it off at all possible, but in any case put to the task respectively. check.
A1 Variable Clear% Locprov
A2 JF aLocman = CONTEXT.getSystemService (location)
[x] // Get a list of active providers
[x] A3 JF provs = aLocman.getProviders (true)
[x] // Check in case there are no such providers
[x] A4 JF% check = provs.isEmpty ()
[x] A5 Flash Status: off If% check ~ true
[x] A6 Stop // Disconnected and replaced with
// Get a list of ALL providers
A3 JF provs = aLocman.getAllProviders ()
A4 For% item items: provs
// Check for inclusion
A5 JF% prov = aLocman.isProviderEnabled (% item)
// Exclude PASSIVE_PROVIDER from the list. In the To: field, write% item with a space or other delimiter
A6 Variable Set% Locprov to% item If% prov ~ true &% item neq passive
A7 End For
A8 Flash Status:% Locprov If% Lockprov Set
A9 Flash Status: off If% Locprov! Set
If location is enabled, the output is gps, network, or both

ToDo


###
Freebie
Sometimes I am asked to help with some simple profile and sometimes there is no desire to send in a hat or search, but there is a desire to simply create a profile - for practice or out of interest. But only occasionally. So that such impulses do not disappear in vain, I decided to organize a special section here.
Missed call notification with contact name output
So, a casino with girls and blackjack as a result of hanging bunshere
Main profile
Profile: MissedEvent
Enforce: no // Cancel the task queue
Event: Missed Call [Caller: *]
Enter: taskLoop
Run Both Together // Copies of tasks will be executed simultaneously
A1: Profile Status Name: MissedState Set: on // If a timer is used to stop
A2: Variable Set Name:% tosay To:% CNAME,% CNUM
A3: Variable Split Name:% tosay Splitter :,
A4: Stop If% List ~ *,% tosay1, * // Stop if this subscriber is already in the list
A5: Variable Set Name:% List To:,% tosay1, Append: On If% tosay2! = 0 // Add a new subscriber to the list. Do you need a subscriber who cannot be called because the number is hidden?
// If so, delete the condition in this and the next step and do not use Auto Dial: on
A6: Variable Set Name:% Num To:,% tosay2, Append: On If% tosay2! = 0 // Action for auto redial. Add the number of the new subscriber to the list, if it is not hidden (not equal to 0)
A7: Perform Task Name: showMissedWindow Stop: Off // Action to display the combo box (see below)
<Loop>// Start an infinite loop
A7: Flash Text: Missed call from% tosay1 If% tosay1! ~% Tosay2 // Flash for example, you can use
A8: Flash Text: Missed call from Unknown caller If% tosay1 ~% tosay2 // any convenient way or several
A9: Wait // Specify the desired repeat interval
A10: Goto Type: Action Label Label: Loop or Type: Action Number Number: 7


1. Profile for stopping the cycle after viewing missed calls and auto redial
Profile: MissedState
State: Missed Call [Caller: *]
Enter: blank // Do nothing, just wait a bit
A1: Wait Seconds: 1

Exit: stopLoop
// Actions A2, A3, and A5 are used for auto-chime
A1: Stop Task: taskLoop
A2: Variable:% Num Search: ([^,] +) Store Matches in:% Num // Search for combinations that do not contain, (comma)
A3: Call% Num (>) Auto Dial: on / off If% Num (#)>1 //% Num (>) - first skipped,% Num (<) - the last, Auto Dial to taste.
// Condition% Num (#)>1 added because there is a Call button in the blind for one missed call
// If you don’t use it, you can remove the condition, and then after clicking on the notification in the blind
// and go to the log the dialer window will be displayed
A4: Variable Clear Name:% List
A5: Variable Clear Name:% Num // Clear the list of names and numbers


2. Profile for stopping the cycle and chime with a timer
Profile: MissedState // Auto redial works in this profile if you view missed calls BEFORE the timer ends.
// If the timer reaches the final on its own, there will be no auto-chime (no one has approached the phone), notifications will simply stop
Enforce: no // Cancel the task queue
State: Missed Call [Caller: *]
Enter: blank // The timer is started, after a time the profile is deactivated and the Exit Task starts
A1: Wait // Duration of the cycle (s). The timer does not restart for newly skipped during this time.
A2 Profile Status Name: MissedState Set: off
// Do not forget to add to the beginning of the taskLoop task Profile Status Name: MissedState Set: on
// so that the profile is activated for the next missed call

Exit: stopLoop
A1: Stop Task: taskLoop
A2: Variable:% Num Search: ([^,] +) Store Matches in:% Num
A3: Call% Num (>) Auto Dial: on If% TRUN ~ *, blank, * & If% Num (#)>1 // Call back if the timer is still ticking (% TRUN ~ *, blank, *)
A4: Variable Clear Name:% List
A5: Variable Clear Name:% Num
A6: Stop Task: blank // Turn off the timer


Task for displaying a window with a list of names
showMissedWindow // Do not forget to remove animation from Scene actions
A1: Destroy Scene Name: missedcall // Kill the previous scene
A2: Variable Search Replace Variable:% List Search: (^, +) Store Matches In:% list // Create arrays of names and numbers
A3: Variable Search Replace Variable:% Num Search: (^, +) Store Matches In:% num
A4: Create Scene Name: missedcall // Create the scene again and arrange the elements
<last item>
A5: Variable Set Name:% last To:% list (#) // Last element of the array
<more elems>
A6: Variable Set Name:% more To:% last-8 Do Maths: On // How many names will not fit in the notification
<center from top>
A7: Variable Set Name:% center To: (900-100 *% last) / 2 Do Maths: On If% last<9 // Set the height offset so that the notification is centered
// Set the text and visibility for elements showing that not all subscribers fit in the notification
<subtitle text>
A8: Element Text Scene Name: missedcall Element: sub Position: Replace Existing Text: +% more Go to journal
<subtitle visibility>
A9: Element Visibility Scene Name: missedcall Element Match: sub Set: True Animation Time (MS): 0 If% last> 8
<log visibility>
A10: Element Visibility Scene Name: missedcall Element Match: log Set: True Animation Time (MS): 0 If% last> 8
<lool for title>
A11: For Variable:% elem Items: back, icon, title // Put the title elements at the desired position
A12: Element Position Scene Name: missedcall Element:% elem X: 4 Y:% center Animation Time (MS): 0
A13: End For
<check last>
A14: Variable Set Name:% last To: 8 If% last>8 // If there are more names, set a limit for the loop
<main loop>
A15: For Variable:% item Items: 1:% last
<center position var>
A16: Variable Set Name:% pos To:% center + 100 *% item Do Maths: On // Vertical offset for the element
// Visibility and position for name and img elements
<name visibility>
A17: Element Visibility Scene Name: missedcall Element Match: name% item Set: True Animation Time (MS): 0
<img visibility>
A18: Element Visibility Scene Name: missedcall Element Match: img% item Set: True Animation Time (MS): 0
<name position>
A19: Element Position Scene Name: missedcall Element: name% item X: 4 Y:% pos Animation Time (MS): 0
<img position>
A20: Element Position Scene Name: missedcall Element: img% item X: 620 Y:% pos Animation Time (MS): 0
// Set the text for name and num
<name text>
A21: Element Text Scene Name: missedcall Element: name% item Position: Replace Existing Text:% list (% item)
<num text>
A22: Element Text Scene Name: missedcall Element: num% item Position: Replace Existing Text:% num (% item)
A23: End For
// Size and position for the background
A24: Variable Set Name:% bsize To: 100 + 100 *% last Do Maths: On
A25: Element Size Scene Name: missedcall Element: back Width: 712 Height:% bsize Animation Time (MS): 0
A26: Show Scene Name: missedcall Display As: Overlay, Blocking Horizontal Position: 100 Vertical Position: 100 Animation: System Show Exit Button: Off

The scene itself(Portrait 5 "720h1280) consists of a substrate for filling the dividing lines, a header with icon and 17 (8 named + 8 numbered + 1 to enter the magazine) hidden elements Text with associated interactive pictures (also hidden). The scene shows a list of subscribers from whom missed calls. Pressing the button to the right to close the stage and open the dialer window with administration of the selected phone number. If there are more than 9 display a line with the number of unreached call with an invitation to go to the log. For perhoda log used action CallLog View, but my dialer is not caused by a magazine and SmartDial window, so I used for myself
Run Shell am start --user 0 com.android.dialer / com.mediatek.dialer.calllogex.CallLogActivityEx
For a regular android, I think it’s suitable:
Run Shell am start --user 0 com.android.dialer / com.android.dialer.calllog.CallLogActivity
The icon at the top left closes the scene. Any interactive action clears the% List and% Num lists, but not the count of skipped unread. Also, notifications from the curtain are not deleted.
Not added
Reset new missed counter
Run Shell content update --uri content: // call_log / calls --bind new: i: 0 --where "new = '1'"
Delete notification from the curtain
Java function
TelephonyManager.getItelephony (). CancelMissedCallsNotification () (or cancelMissedCallsNotificationGemini (int simId) for MTK dvuhsimochnik)
but since we have a SecurityException, we will use
Run Shell service call phone TRANSACTION_CODE (i32 simId)
Contrary to usual, I lay out the task and the scene for it (for there is no desire to explain how I did it). Hope that I saw out all the codes for sending SMS to paid numbers in Zimbabwe ;-)
Photo report
Attached Image
Attached Image
Attached Image
Attached fileTask_n_scene.zip(2.9 KB)

Autonotification setup in pictures
The profile catches a notification when the access point is turned on and clicks on it
Attached Image

APNotification
Profile: APNotif (74)
Event: AutoNotification Intercept [Configuration: Event Behavior: true
Notification Type: Only Created Notifications
Has Reply Action: false
Notification App: Android System
Notification Title: Modem Enabled
Notification Text: 0 connected, 0 blocked
Get All Fields: false
Get Internal Actions: false
Get Internal Actions Big: false]
Enter: APAutonotifiAction (76)
A1: AutoNotification [Configuration: Use HTML: false
Action on Touch:% antouchaction
Skip Picture Cache: false
Update Notification: false
Only on Phone: false Package: com.joaomgcd.autonotification Name: AutoNotification Timeout (Seconds): 20]

Attached Image
Attached Image
Attached Image

First, check that Autonotification has access to notifications (Phone settings - Security - Access to notifications)
Attached Image

Create a profile with the context Event - Plugin - AutoNotification (Intercept). Click pencil opposite Configuration
Attached Image
Attached Image
Attached Image
Attached Image

Easy way - we configure the plugin according to the currently existing notification (Fill From Current). We select our notification from the list and check the necessary parameters with daws. Do not forget to confirm the settings by clicking on the daw at the top.
Attached Image
Attached Image
Attached Image
Attached Image

In the main window, under the Action Type section, select Created, i.e. the profile will only work when a notification appears. We save and check the settings.
Next, create a task with the action Action - Plugin - Autonotification (AutoNotification)
Attached Image
Attached Image
Attached Image
Attached Image
Attached Image

In the Action field that appears, enter the name of the variable AutoNotification% antouchaction - this is a tap on the intercepted notification

Car radio
The task - when turning on the ignition (and power), turn on the screen and start the audio player, after turning off the power - put it on pause.
Profile
Profile: OnPower (94)
State: Power [Source: Any]
Enter: player_enter (89)
A1: Popup [Title: Greeting Text: Power On Background Image: Layout: Popup Timeout (Seconds): 3 Show Over Keyguard: On] // Turn On The Screen
A2: Display Timeout [Secs: * Mins: * Hours: *] // Set the screen off time to "Never" (requires verification). This is Action-Setting
A3: Media Control [Cmd: Play [Simulated Only] Simulate Media Button: On App: Music] // Play using a standard player.
Exit: player_exit (92)
A1: Wait [MS: 0 Seconds: 5 Minutes: 0 Hours: 0 Days: 0]
A2: Stop [With Error: Off Task: player_exit] If [% PACTIVE ~ * OnPower *] // Stop the output task during a short power off
A3: Media Control [Cmd: Pause Simulate Media Button: On App: Music] // Pause playback
A4: System Lock // Turn off the screen

Kustom Live WallPaper (KLWP)
Animation from pictures
Profile: Kustom Anim (95)
State: Display State [Is: On]
Application: Apex Launcher
Enter: startAnim (96)
A1: List Files [Dir: Kustom Match: Include Hidden Files: Off Use Root: Off Variable:% Img]
A2: For [Variable:% item Items: 1:% Img (#)]
A3: Wait [MS: 0 Seconds: 1 Minutes: 0 Hours: 0 Days: 0]
A4: Variable Set [Name:% Kanim To:% Img (% item) Do Maths: Off Append: Off]
A5: KLWP Send Variable [Configuration: Set: anim Package: org.kustom.wallpaper Name: KLWP Send Variable Timeout (Seconds): 0]
A6: End For
A7: Goto [Type: Action Number Number: 2 Label:]
Exit: stopAnim (98)
A1: Stop [With Error: Off Task: startAnim]

Infa about the "running" applications
Task
ApPs (94)
A1: Run Shell [Command: ps | grep NAME 2>/ dev / null & Timeout (Seconds): 0 Use Root: Off Store Output In:% Apps Store Errors In: Store Result In:]
A2: If [% Apps! Set]
A3: Variable Set [Name:% Apps To: 0 Do Maths: Off Append: Off]
A4: KLWP Send Variable [Configuration: Set: apps Package: org.kustom.wallpaper Name: KLWP Send Variable Timeout (Seconds): 0]
A5: Stop [With Error: Off Task:]
A6: End If
A7: Variable Set [Name:% Apps To: 1 Do Maths: Off Append: Off]
A8: KLWP Send Variable [Configuration: Set: apps Package: org.kustom.wallpaper Name: KLWP Send Variable Timeout (Seconds): 0]


###
Searchingcaptain grantsetPreferredNetworkType () method
The MNOGA-BUKOFF proposed below is an extensive, but uninformative (behind the scenes principles of the Android system, actions of the Java Function Tasker and Java in general) instruction tested on the MTK dvuhsimochnik with android 4.4.2 on board.
Discussion in the topic - search on the nicknames mentioned below and various foreign words that appear in the text, such as setPreferredNetworkType.
It all started with a post* Partyzzan answer * username11 and the desire to switch Network Type with Tasker.
A quick look at the sources of GravityBox, Android and logcat to switch the type of network led to the line
Run Shell: settings put global preferred_network_mode
those. write to the database com.android.providers.settings the desired value of the network type. But this was not enough, because only the indication in the quick settings curtain changed, and the settings were applied only after a reboot.
I did not want to consider the way with switching to Flight mode and vice versa, restarting the com.android.phone process looked too radical. There was still (in my opinion) a search for magical intent, thanks to which the android will guess that the type of network needs to be updated. After reviewing some of them, whichpossiblyThey would help me, it turned out that they (these intents) can only be sent by the system application. This went beyond the scope of the task, and the search for a while stopped.
Lyrical digression - Magic Intent
A magical intent with which you can switch the network type without changing the tasker
Send Intent Action: com.android.phone.NETWORK_MODE_CHANGE Extra: com.android.phone.NETWORK_MODE_CHANGE: intNW Extra: simId: intSIM
Option on JF (well, I like this thing)
A1 myIntent = new.Intent (com.android.phone.NETWORK_MODE_CHANGE)
A2 myIntent.putExtra (com.android.phone.NETWORK_MODE_CHANGE, NW (int))
A3 myIntent.putExtra (simId, SIM (int))
A4 CONTEXT.sendBroadcast (myIntent)
Then a post appeared* Partyzzan dedicated to service call, and searches resumed. Having analyzed as many as three framework files (framework, framework2 and mediatek-framework), I searched for setPreferredNetworkType by the contents of the received files and ... found nothing.
Searches again stopped until, using the influx of newcomers to the topic, I did not abandon the Sami-Know-Who fishing rod to get directions on a matter of interest to me. The next step led to another system service (in addition to phone) related to the operation of the phone - phoneEx, which relies on com.mediatek.telephony.ITelephonyEx.
To get to the desired class, I had to parse all the files in the system / framework involved (by name) in telephony and mediatek. The required class was found in mediatek-common.jar, and next to it is ITelephonyEx $ Stub with the TRANSACTION set for use with service call.
Having audited transactions for something similar to 3GCapability, I found TRANSACTION_set3GCapabilitySim. This transaction sets 3G mode (more precisely network type 3G / 2G Auto ~ WCDMA Preferred) on one of the SIM cards (0 or 1) or turns it off (-1) using
Run Shell: service call phoneEx intTransaction i32 intSimSlot
Lyrical digression - TRANSACTION code
Way* Partyzzan on jf. Search for the required TRANSACTION in the ITelephony $ Stub class without disassembling the framework.
Your own Toggle Network Type
// JF - action Code - Java Function
A1 JF clTphstub = Class.forName (com.android.internal.telephony.ITelephony $ Stub)
A2 JF decFields = clTphstub.getDeclaredFields ()
A3 For% item items decFields
A4 JF decfield = clTphstub.getDeclaredField (TRANSACTION_setPreferredNetworkType) If% item ~ * setPreferredNetworkType // Try to find the desired TRANSACTION
A5 End For
A6 Flash Not Found! If decfield! ~ * SetPreferredNetworkType // Note decfield is local, because ...
A7 Stop If decfield! ~ * SetPreferredNetworkType // Stop the task if there is no such TRANSACTION
A8 JF decfield.setAccessible (true)
A9 JF% Ntrans = decfield.getInt ()
A10 Run Shell service call phone% Ntrans i32 intNW
Perhaps this transaction is not found, but you can find something else tasty by adding to the cycle of action
[S] [X] A4 Variable% item Search: ([A-Za-z] + $) Store Matches in:% Field [/ S]
A4 Variable% item Search: ([^] * \ s) {1,} ([^] * \.) {1,} ([^ \.] + $) Store Matches in:% Field Replace Matches: On Replace With: $ 3 ****
A5 Write File: fields.txt Text:% Field Append: On Add New Line: On
and after reading at your leisure the resulting file with a list of the received TRANSACTION. **** Fixed search pattern
But this was still not enough, and the search for setPreferredNetworkType from the newly received files brought to the Phone class, which contained the desired method. No Stub was attached to it, and it was decided to use the Java Function.
For further searches, I downloaded the sources of my firmware (java reads much better than smali (for me), and is useful in work).
Events developed at a staggering speed (I recall that the first message from Partyzzan was dated April 2015, and a week passed from the proposal to use JF (January 2016) to solve the problem).
Getting an ITelephony object and its associated methods (all actions are Java Function, only objects, classes and methods are left for readability)
Task Retrieving an ITelephony Object
A1 tManager = CONTEXT.getSystemService (phone)
A2 cltManager = tManager.getClass ()
A3 mtManager = cltManager.getDeclaredMethod (getITelephony, null)
A4 mtManager.setAccessible (true)
A5 objITelephony = mtManager.invoke (tManager, null)
Now we have access to all methods of the objITelephony object, i.e. various settings and conditions of the phone by clicking Magnific Glass in the Function field. But this is still not enough, since I still have not reached the setPreferredNetworkType () method.
For the next step, as one famous illusionist said, you have to blow, otherwise nothing will work. Well, it’s not necessary to blow, but you will have to modify the tasker (or not - read the task note Getting the Phone object below ***. Then you can skip the mockery of Tasker).
You can execute methods of the Phone class only in the process com.android.phone, and the application that calls these methods must be signed with the same key ** as com.android.phone and be system, i.e. be in system / app.
Therefore, we parse the tasker in any convenient way and edit AndroidManifest.xml. In tag<manifest>add
android: sharedUserId = "android.uid.phone"
and in tag<application>
android: process = "com.android.phone"
More indocumentation. We collect the tasker back and sign it with the system key, which we take in the firmware sources in the build \ target \ product \ security folder
** About the system signature
(** my firmware is not official and was going to use test keys. You can not find the system signature on your firmware)
Now we backup our good old favorite tasker and delete it, and in its place we put the mod and make it systemic. You can proceed to writing the task.
The task is to obtain an object of the Phone class and its methods through the PhoneFactory class. Again, only JP and only basic, variables and conditions can be hung to taste. And one more thing: some actions may seem unnecessary, but I started to write based on the examples found on the network, still not really understanding what would happen, therefore corrections are welcome.
Task Retrieving a Phone Object
A1 cntxResolver = CONTEXT.getContentResolver ()
A2 Global.putInt (cntxResolver, preferred_network_mode, NetworkType (int)) // This is exactly the line where it all started. NetworkType (int) - a number corresponding to the type of network, more in the Partyzzan post
A3 clLoader = CONTEXT.getClassLoader ()
A4 clPhoneFactory = clLoader.loadClass (com.android.internal.telephony.PhoneFactory)
A5 objPhoneFactory = clPhoneFactory.newInstance ()
A6 methodDefPhoneFactory = clPhoneFactory.getDeclaredMethod (getDefaultPhone, null)
A7 methodDefPhoneFactory.setAccessible (true)
A8 objGeminiPhone = methodDefPhoneFactory.invoke (objPhoneFactory, null) // Here we already get some goodies like set3GCapabilitySim, but our goal is ahead.
A9 objPhone = objGeminiPhone.getDefaultPhone () // The object of the class Phone ***
A10 objPhone.setPreferredNetworkType (NetworkType (int), null) // Profit!
*** On some devices, you can get objPhone without Tasker modification. Try, if objGeminiPhone! = Null in A8, then no modification is needed
Look at the last step for a list of available methods - maybe that’s useful on the farm ;-). In order to facilitate the choice of network type, you can substitute a global-user variable instead of the hard NetworkType (int).
But that is not all. I do not want to have a system-modified tasker, but not because of security problems, but simply because I want to solve problems with an ordinary tasker, like everything in this topic. What to do?
Everything is simple - you need to delegate all the rights and obligations to the child application using AppFactory. We export the As App task, with additional permissions we do not bother yet, we will still edit AndroidManifest.xml. We parse our task application and do the same with it as with the tasker at the beginning of our operation. In addition, we add permissions
Permissions *
<uses-permission android: name = "android.permission.MODIFY_PHONE_STATE" />
<uses-permission android: name = "com.android.phone.CHANGE_NETWORK_MODE" />
<uses-permission android: name = "android.permission.WRITE_SETTINGS" />
<uses-permission android: name = "android.permission.READ_PHONE_STATE" />
<uses-permission android: name = "android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android: name = "android.permission.ACCESS_NETWORK_STATE" />
* I haven’t figured out the permissions yet, I added those that are suitable in name and meaning to the task from AndroidManifest.xml Tasker, but I promise to correct in the future and bring the permissions to the necessary minimum.
During the assembly, I got a bunch of errors related to resources, without hesitation, I copied the entire res directory from the folder with the disassembled tasker to the folder of our application. The application got heavy by 800 kb. I also promise to deal with this later (in the sense of choosing only the necessary resources). We sign with a system key.
Removegenetically-modified Tasker and restore your beloved, old and kind. Install your application and make it system. In the tasker, create a task with the Launch App action, where we select our application.
That seems to be Everything. Personal thanks to the characters mentioned in the text for the idea and direction and
A little bit about yourself
An economist-auditor-accountant (not a techie as you can see), working as a mechanic at an engineering plant (that is, the workers never pros). It's not me to the fact that here, they say, which I Kulibin, and to the fact that neither my education or my job, or age is not prevented me almost alone to deal with some questions of programming and of the OS Android. As they say, it would wish. Although I am certainly a little dissemble, as for computer I sat yesterday, but special education courses in addition to the user's PC as part of the college, I did not get. After reading this, you will understand why this topic of particular relevance to people asking for help with basic functions Tasker and call themselves programmers or justify their notknowledgedesire for a liberal arts education.

###
Android settings using settings & content
Starting with Android 6, settings has a new command - list
Display settings on screen
tenshi: / $ settings
usage: settings [--user<USER_ID>| current] get namespace key
settings [--user<USER_ID>| current] put namespace key value
settings [--user<USER_ID>| current] delete namespace key
settings [--user<USER_ID>| current] list namespace
'namespace' is one of {system, secure, global}, case-insensitive
If '--user<USER_ID>| current 'is not given, the operations are performed on the system user.
Now with its help you can see the contents of the database tables com.android.providers.settings. Or search for the proposed parameter with
settings list system | grep something

Settings $ System
Turn on / off auto-rotate display
settings put system accelerometer_rotation 1/0
Force rotation
settings put system user_rotation 0/1/2/3
1.3 - Landscape left / right, 2 - Portrait upside down.
Same thing with content
Disconnect and switch SIM
settings put system dual_sim_mode_setting dualState; am broadcast -a android.intent.action.DUAL_SIM_MODE --ei mode dualState
where dualState 1 - the 1st sim works, 2 - the 2nd, respectively, 3 - both, 0 - both are disabled.
Default SIM selection for sending SMS
setiings put system sms_sim_setting SimN
where SimN 1 is the first sim, 2 is the second sim, -1 is always to ask.
Select default SIM for voice call
settings put system voice_call_sim_setting SimN
where SimN 1 is the first sim, 2 is the second sim, -1 is always to ask.
Enable, switch mobile data between SIM cards and disconnect
settings put system gprs_connection_setting SimId; settings put system gprs_connection_sim_setting SimId
where SimId 1 is the first sim, 2 is the second sim (and even 3 and 4, if there is multisym), 0 - disable
Lyrical digression - settings non-Root
A1 JF ctxResolv = CONTEXT.getContentResolver ()
// For the system table
A2 JF android.provider.Settings $ System.putString (ctxResolv, String name, String value)
Show clicks
settings put system show_touches 1
Display touches
settings put system pointer_location 1
Day and time of the next alarm (receive)
settings get system next_alarm_formatted
Turn off the LED It will not light up when charging or notifications.
settings put system notification_light_pulse 0
Accordingly, enable - 1

Settings $ Global
Airplane mode Post valadei
settings put global airplane_mode_radios cell, bluetooth, wifi, nfc, wimax; settings put airplane_mode_toggleable_radios bluetooth, wifi, nfc
Interface settings that will be disabled when Airplane mode is turned on and which can be enabled when Airplane is active.
settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
Turn on Airplane mode. Disabling 0 and false, respectively

Settings $ Secure
Turn on / off color correction mode
settings put secure accessibility_display_daltonizer_enabled 1/0
and Choosing a mode for him
settings put secure accessibility_display_daltonizer n
3 predefined n = 11, 12, 13, but you can play with other numbers
Enable / disable color inversion mode (a-la negative)
settings put secure accessibility_display_inversion_enabled 1/0
Turn on / off night mode (yellow backlight)
settings put secure night_display_activated 1/0
Lock Screen Owner Information (get) Not really a setting, and not at all settings or content, but sometimes they ask.
Run shell command: sqlite3 /data/system/locksettings.db 'select value from locksettings where name = "lock_screen_owner_info"' Store Output in% Owner
Lyrical digression - sqlite3
The owner information on the lock screen is not in the providers.settings database, but in /data/system/locksettings.db.
Name fields in locksettings.db
migrated
migrated_user_specific
lock_pattern_autolock
lockscreen.password_type
lockscreen.password_type_alternate
lockscreen.disabled
lockscreen.voice_weak_fallback_set
lock_screen_owner_info
lockscreen.lockoutattemptdeadline
lock_screen_owner_info_enabled
The remaining fields are user and value
As you can see, there is lock_screen_owner_info_enabled (and other settings), but writing values ​​to them is useless - the settings will not be applied (at least without a reboot). Moreover, in settings / secure there is also lock_screen_owner_info_enabled, but there is also a record in the table with
settings put secure lock_screen_owner_info_enabled 1/0
or
content update --uri content: // settings / secure --bind value: i: 1/0 --where 'name = "lock_screen_owner_info_enabled"'
settings will not change. The sqlite3 binary took along the path /data/data/com.keramidas.TitaniumBackup/files (like, you are not doing backup applications yet?) And copied it to / system / xbin

###
Shell scripts
In general, everything has already been chewed enough in the relevant topic, here are more likely marginal notes.
Literature
The book is aimed at the most unpreparedacademicianuser with emphasis not on tricky, but, if possible, the simplest scripts. It can be used as a reference. There are typos (for example, in the sections on regexp), which can add a self-test element to reading.
Attached fileTensley Linux and UNIX programming in shell.fb2.zip(565.69 KB)
And this is from a child theme. Version for reading on the go. The file was corrected and reloaded on 07.24.16Attached fileSoloviev A. Shell Programming (UNIX) .fb2.zip(32.51 KB)

First things first - you need a "direct" busybox.
busybox
The busybox.net binary apparently didn’t. On tipmyxa781 installed the binary from BitCubate, it has inotifyd and the {system (command)} function in awk works. (PS. But the find and printf curves)
Quick installation and problem solving As a rule, not very experienced users use various installers to install busybox, some of which may be paid. But if you understand the process a little bit, then there is nothing complicated in the installation, you do not need any installer, all the more paid. The whole process can be performed using the terminal (or its emulator in the phone) and the file manager (optional).
If busybox is not in the phone.Throw the binary in system / xbin
In the terminal
cp / path / where / busybox / system / xbin
set the rights to the file 755 (the letter P - in the file manager)
in the terminal
chmod 755 / system / xbin / busybox
and install using
/ system / xbin / busybox --install -s / system / xbin
Voila - busybox with symlinks inpocketsystem. Naturally, the system must be mounted on record
in the terminal
mount -o remount, rw / system
If busybox is already installed. Before copying to system / xbin, rename the binary, drop it, delete the old one, rename the new one, set the rights, do --install.
If the symlink is removed. (or the installer did not create a curve)
ln - s busybox / system / xbin / [applet_name]
If the applet is not in the binary(or the existing one does not work / works crookedly). We take the busybox binary with the necessary (or working) applet, rename it to [applet_name], delete the symlink (if any) and drop our busybox applet into system / xbin with setting rights.
Closing WarningsIt is not recommended (re) to install busybox for firmware with busybox already installed (it may lose functionality up to a flashing). In any case, before changing the system partitions, you need to make a nandroid backup.
Attached fileBusybox1.24.1SELinuxEnabled_arm.zip(1.11 MB)
- archive for firmware via recovery from* adm_
Attached filebusybox.zip(669.21 KB)
- just a binary in the archive

Tracking hardware button presses and tasker task launch (in this case, pressing VOL + and launching the flash task).
script -q -c 'getevent / dev / input / event0' / dev / null | awk '/ 0001 0073 00000000 / {system ("am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name flash")}'>/ dev / null &
And someone asked in the topic about the "empty line from not pressing the screen" in order to track inactivity. I found a unique release line in mtk-tpd (touchpad) - you can start the inactivity timer with the Abort Existing Task in the task settings.
Phone vibration tracking
Lyrical digression - some experiments
I have a couple of files in the / sys / devices / virtual / timed_output / vibrator folder: enable - if you write any arbitrary number to it using
echo N>/ sys / devices / virtual / timed_output / vibrator / enable
get a vibration of duration N ms. If you write to another file - vibr_on 1
echo 1>/ sys / devices / virtual / timed_output / vibrator / vibr_on
we get endless vibration until we write 0. 0. But that's not what I mean. There are other ways to play with vibro, but what about tracking the moment of vibration itself. This can be done using the File Modified context, but ... During the experiments it turned out that some actions (for example, lowering the curtain) reproduce zero vibration. I didn’t really like it, and I decided to separate non-zero values ​​from zero using
cat / sys / devices / virtual / timed_output / vibrator / enable
with variable output in Tasker. Here again, I am expecting an ambush, since all zeros are in a variable. Only an increase in vibration duration to 1.5 seconds to somehow affect the outcome, and it turned out that Tasker delayed somewhere on the second. Then I turned my gaze to busybox inotifyd, which in conjunction with the cat showed a record low (compared to Tasker) result - 1-2 ms. Record the values ​​in the file showed that the file is written to 2 times - at the beginning of the vibration, and at its end. Thus was born this script, good template for it was found in the relevant subject. When using make allowances for its firmware
inotifyd - / sys / devices / virtual / timed_output / vibrator / enable: w | while read event; do cat / sys / devices / virtual / timed_output / vibrator / enable | grep -q '^ [^ 0]' && am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name vibra; done>/ dev / null &
The vibra task runs if the value in the file / sys / devices / virtual / timed_output / vibrator / enable does not start at 0.
Script Killer (in development / under discussion)
ps | awk '/ script / {print $ 2}' | xargs kill>/ dev / null &
Kills a process called script. The disadvantage is that it kills all processes with the same name.
PID of the last process script
Run shell ps | awk '/ script / {print $ 2}' | sed -n '$ p' Store Output in% Var
It was intended as tracking the last script launched from the tasker (since they are all named script), but
Explanation
Username11 @ 05/02/2016, 14:20 *
slax, * .... * It's not so simple here. Apparently, the “last running script” cannot be traced, Tasker uses his shell instances as a cache, the next Run Shell is sent to the first free one. But here you can just get the pid of the shell that performs the Run Shell action, you need to go through the parent pid chain to Tasker himself.
* sergr59, what do we want to achieve? You can run scripts from a file, for example, then they will have a name.

Search List File like
Name Value1 Value2 ...
Name Value1 ...
a string containing the Tasker variable% Name and returning the Value of the desired field (in the example, the second (Value1)) to the% Result variable
awk '/% Name / {print $ 2}' path / filename [Store output in:% Result]

Print date other than current
busybox date +% d.% m.% y -d @ $ (expr $ (busybox date +% s) + 86400)
Run shell Command: busybox date +% d.% M.% Y -d @ $ (expr% TIMES + 86400) // Option for Tasker and his% TIMES
Run shell Command: export TZ = UTC + 24; date +% d.% m.% y
In the first two cases, the date is a day ahead, in the last - a day ago.
Blinking backlight soft keys
echo 1>/ sys / class / leds / button-backlight / brightness; sleep 1; echo 0>/ sys / class / leds / button-backlight / brightness; sleep 1

A little grep
grep OR
grep -e 'pattern1' -e 'pattern2'
grep -E 'pattern1 | pattern2'
grep AND
grep -E 'pattern1. * pattern2 | pattern2. * pattern1 '
Call Forward Notification
Tested on AOSP 4.4.2 dualSIM MTK. Need the right busybox.
We monitor logcat for notification from com.android.internal.telephony.gsm.SuppServiceNotification. This class represents an optional notification service received from the network. Its approximate content
SuppServiceNotification.java
static public final int MO_CODE_UNCONDITIONAL_CF_ACTIVE = 0;
static public final int MO_CODE_SOME_CF_ACTIVE = 1;
static public final int MO_CODE_CALL_FORWARDED = 2;
static public final int MO_CODE_CALL_IS_WAITING = 3; // Call on hold
static public final int MO_CODE_CUG_CALL = 4; // CUG - Closed User Group
static public final int MO_CODE_OUTGOING_CALLS_BARRED = 5; // Prohibit outgoing
static public final int MO_CODE_INCOMING_CALLS_BARRED = 6; // Prohibition of incoming
static public final int MO_CODE_CLIR_SUPPRESSION_REJECTED = 7; // CLIR, Calling Line Identification Restriction AntiAON (?)
static public final int MO_CODE_CALL_DEFLECTED = 8; // Call rejected

static public final int MT_CODE_FORWARDED_CALL = 0;
static public final int MT_CODE_CUG_CALL = 1;
static public final int MT_CODE_CALL_ON_HOLD = 2; // Call on hold
static public final int MT_CODE_CALL_RETRIEVED = 3;
static public final int MT_CODE_MULTI_PARTY_CALL = 4;
static public final int MT_CODE_ON_HOLD_CALL_RELEASED = 5;
static public final int MT_CODE_FORWARD_CHECK_RECEIVED = 6;
static public final int MT_CODE_CALL_CONNECTING_ECT = 7;
static public final int MT_CODE_CALL_CONNECTED_ECT = 8;
static public final int MT_CODE_DEFLECTED_CALL = 9;
static public final int MT_CODE_ADDITIONAL_CALL_FORWARDED = 10;

/// M: [mtk04070] [111118] [ALPS00093395] MTK added for call forwarding. @ {
static public final int MT_CODE_FORWARDED_CF = 11;
static public final int MT_CODE_FORWARDED_CF_UNCOND = 12; // Unconditional redirect
static public final int MT_CODE_FORWARDED_CF_COND = 13;
static public final int MT_CODE_FORWARDED_CF_BUSY = 14; // If busy
static public final int MT_CODE_FORWARDED_CF_NO_REPLY = 15; // not responding
static public final int MT_CODE_FORWARDED_CF_NOT_REACHABLE = 16; // Not available
It contains a list of codes for determining the type of call forwarding for both incoming and outgoing calls.
So, we catch the line in the buffer log of the radio
03-01 21: 25: 41.930 D / RILJ (1003): RIL (1): [UNSL RIL]<UNSOL_SUPP_SVC_NOTIFICATION com.android.internal.telephony.gsm.SuppServiceNotification@425ed8a0 mobile terminated code: 12 index: 0 "null"
using script
logcat -c; script -q -c 'logcat -b radio -s RILJ: D' / dev / null | awk '/ SuppServiceNotification / && / terminated / {system ("am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name scFwd")}'>/ dev / null &
or
logcat -c; script -q -c 'logcat -b radio -s RILJ: D' / dev / null | while read code; do echo "$ code" | grep -q -E 'SuppServiceNotification. * terminated' && am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -e task_name scFwd; done>/ dev / null &
The script is pre-launched in any convenient way (for example, using Event - System - Device Boot (do not forget to set the start delay for at least 5 seconds) or Event - Tasker - Monitor start (duplicate scripts are possible)), it monitors logcat for SuppServiceNotification matching during incoming (/ terminated /) call and launches the scFwd tasker task. There is only one action in the task
A1: Show Scene Name: Fwd
In order to remove the notification, create a profile
Profile: Hide Scene
State: Call [Type: Incoming Number: *]
Enter: blank
A1: Wait 1s // Just Wait A Bit
Exit: hide
A1: Hide Scene Name: Fwd // At the exit from the state, hide the scene
The scene itself is at the discretion of the user.
Examples in pictures
Attached Image
Attached Image
Not modified. Transfer code forwarding to tasker.

Unlock pattern
Unlock patternAdditional task from* username11

###
Notification of correct and incorrect SIM
Tested on AOSP 4.4.2 dualSIM MTK
Ideafrom hereexecution on Java Function.
We used the TelephonyManagerEx.getCallState (int simId) method, which returns CALL_STATE_IDLE, RINGING, or OFFHOOK for 0 and 1, respectively, 0, 1, and 2.
JavaFunction details in the Searches sectionKGsPNT () "
Profile: SimNotif
State: Call [Type: Incoming Number: *]
Enter: simN (63)
A1: Variable Set% Simn To 2 // Filter for other operators
A2: Variable Set% Simn To 0 If% CNUM ~ * 903 * // Filter of the operator of the first sim
A3: Variable Set% Simn To 1 If% CNUM ~ * 926 * // Operator filter of the second sim
A4: JF ctxPhone = CONTEXT.getSystemService (phone)
A5: JF clITphony = ctxPhone.getClass ()
A6: JF mITphony = clITphony.getDeclaredMethod (getITelephonyEx) // ITelephonyEx - class responsible for managing SIM cards
A7: JF mITphony.setAccessible (true)
A8: JF objITphony = mITphony.invoke (ctxPhone)
A9: For% item Items: 0.1 // SIM card numbers
A10: JF% State = objITphony.getCallState (% item)
A11: Variable Set% Sim To% item If% State = 1
A12: End For
A13: Show Scene% Simn
A14: Show Scene Wrong If% Simn! ~% Sim
Exit: simNexit (65)
A1: Hide Scene% Simn
A2: Hide Scene Wrong
For the profile, you will need Scene 0, 1, 2 (displaying the operator from which the call is being made) and Wrong for notification of non-compliance. View and location can be seen at* sergr59

###
Mobdata Switching
Summary of the discussionthis Wishlist.
Profiles
Profile: Mdata Apps (61) // Profile of the so-called alarm, just sets the variable depending on whether the application is running or not.
Application:savagemessiahzine.com
Enter: mdappOn (59)
A1: Variable Set [Name:% Appstate To: on Do Maths: Off Append: Off]
Exit: mdappOff (60)
A1: Variable Set [Name:% Appstate To: off Do Maths: Off Append: Off]

Profile: Mdata Off (58) // Main Profile - Switch Mobile Data
Enforce: no // Enforce task order off
State: Display State [Is: Off]
Enter: mdataOff (56)
A1: Wait [MS: 0 Seconds: 0 Minutes: 2 Hours: 0 Days: 0]
A2: Goto [Type: Action Number Number: 1 Label:] If [% Appstate! ~% SCREEN] // "Symbolic" comparison of two variables
A3: Mobile Data [Set: Off]
A4: Wait [MS: 0 Seconds: 0 Minutes: 20 Hours: 0 Days: 0]
A5: Mobile Data [Set: On]
A6: Goto [Type: Action Number Number: 1 Label:] // Infinite loop
Exit: mdataOn (57)
A1: Stop [With Error: Off Task: mdataOff] // Stop the input task when the profile is deactivated
// Do not switch mobdata, restore settings work

Profile: WiFi On (69) // Turn On WiFi. For example, you can make your own. The main thing is marked with comments
State: Wifi Near [SSID: * MAC: * Capabilities: * Min. Activate Signal Level: 0 Channel: 0 Toggle Wifi: On]
Enter: wifi On (70)
A1: WiFi [Set: On]
A2: Profile Status [Name: Mdata Off Set: Off] // Turn off the profile to turn off the mobdata
Exit: wifi Off (71)
A1: Profile Status [Name: Mdata Off Set: On] // Turn on the profile for turning off the mobdata

During the discussion, topics were discussed: state and event, initial and output tasks, task operation after deactivating the profile, disabling the enforce task order, using restore settings for action-settings, optionally disabling mobdata when WiFi is turned on.
Not finalized / not discussed: turning on mobdata when starting applications, stopping applications during a long screen shutdown, tracking the end of file download.
Chat rubbed, as promised, if there will be a continuation of the discussion - I’ll add the results here.

###
Battery Notification
Nothing special, just changing the wait time for the test depending on the charge level. Explanation: the profile was created for a soundly sleeping device (the tasker contexts did not work), which needed to be woken up to track the charge level.
Profile: Charge complete (33)
Enforce: no
State: Charging [Source: Any]
Enter: charge (34)
A1: Variable Set [Name:% Wait To: floor (60-% BATT / 1.7) Do Maths: Off Append: Off] //The time taken is 60 minutes from a full charge to a full charge, 1.7 ~ 100/60
A2: Wait [MS.07 Seconds: 0 Minutes:% Wait Hours: 0 Days: 0]
A3: GoTo [Type: Action Number Number (number): 1 Label:] If [% BATT< 100 ]
A4: For [Variable:% item Items: 1: 3] //Repeat 3 times
A5: Beep [Frequency: 8000 Duration: 1000 Amplitude: 50 Stream: 3]
A6: Wait [MS.:07 Seconds: 0 Minutes: 1 Hours: 0 Days: 0]
A7: End For

Exit: charge stop (22)
A1: Stop [With error: Turn off Task: charge] //We stop the initial task of disconnecting from the power source

Instead of A6 - A9, you can insert your actions: play once or in an endless loop (you will listen at night that "... the battery is charged, the battery is charged, the battery is charged ...";))

###
Work with the call log
We clean the tails
We clean the tails while in the coverage area of ​​a particular wifi AP.
Standard Tasker Actions
The principle is the cascading switching of profiles upon the occurrence of a given event or state.
Profiles
Profile: call YOUNUMBER (49)
State: Call [Type: Any Number: YOU-NUMBER] //Add your number / numbers and / or filter incoming / outgoing
Enter: blank (67)***
A1: Wait [MS: 0 Seconds: 1 Minutes: 0 Hours: 0 Days: 0]
Exit: setPhoneIdleOn (50)
A1: Profile Status [Name: Phone Idle Set: On] //Include the following profile

Profile: PhoneIdle (65)
Event: Phone Idle //Track the end of a call / conversation
Enter: setAPnearOn (66)
A1: Profile Status [Name: YOU AP near Set: On] //Include the following profile
A2: Profile Status [Name: PhoneIdle Set: Off] //Turn off this one - it is no longer needed. Everything is ready for the main task.

Profile: YOU AP near (51) //Track the desired wifi AP
State: Wifi Near [SSID: YOUSSID MAC: * Capabilities: * Min. Activate Signal Level: 0 Channel: 0 Toggle Wifi: Off] //Add SSID of the desired network
Enter: clearCallLog (52)
A1: Call Log [Action: Clear All]
A2: Profile Status [Name: YOU AP near Set: Off] //After clearing the log, turn off this profile, otherwise it will clear the log every time this network is detected

***Added after readingparagraph 6.
The PhoneIdle profile is needed to work out the main (YOU AP near) profile when receiving a call (or outgoing) ALREADY in the AP coverage area.
At the end of the call, the call log will be cleared. The downside is clearing the entire log. And if you need only a certain number? Go to

Content and Run Shell Utility
Incomprehensible hack to remove a specific tip number from the journalfrom hereandto here:
content query --uri content: // call_log / calls --projection name: number --where "number = 'YOU_NUMBER'" // find the number in the call log
content delete --uri content: // call_log / calls --where "number = 'YOU_NUMBER'" // delete all entries with this number in the log

Well, actually, a profile for him
Profile Example
Profile: AP near (46)
State: Wifi Near [SSID: YOUSSID MAC: * Capabilities: * Min. Activate Signal Level: 0 Channel: 0 Toggle Wifi: Off]
Enter: deleteNumber (49)
A1: Run Shell [Command: content query --uri content: // call_log / calls --projection name: number --where "number = 'YOU_NUMBER'" Timeout (Seconds): 0 Use Root: On Store Output In:% Check_number Store Errors In: Store Result In:]
A2: If [% Check_number ~ * YOU_NUMBER *]
A3: Run Shell [Command: content delete --uri content: // call_log / calls --where "number = 'YOU_NUMBER'" Timeout (Seconds): 0 Use Root: On Store Output In: Store Errors In: Store Result In :]
A4: End If

Java functionl
Formulation of the problem.
Help in solving.
Scoop to help
There was still something left that was not included.
Code for Tasker task:
cresolv = CONTEXT.getContextResolver ();
clog = new Calls ();
select = new String [] (1);
select [0] = "+ number";
// Database query - select records containing + number in the number field
cur = cresolv.query (clog.CONTENT_URI, null, number = ?, select, null);
// Delete all records containing + number in the number field
cresolv.delete (clog.CONTENT_URI, number = ?, select);
// Add a new record (it works for me without errors in the dialer when adding the following fields)
values ​​= new ContentValues ​​();
values.put (clog.NUMBER, + new_number);
values.put (clog.DATE, date-in-ms);
values.put (clog.DURATION, in-sec);
values.put (clog.TYPE, int 0: 2);
values.put (clog.CACHED_NAME, New Name);
cresolv.insert (clog.CONTENT_URI, values);
// Change the value of the number field in records containing + number
cresolv.update (clog.CONTENT_URI, values, number = ?, select);
The update () method may not update the fields in the name of which are CACHED - CallLog.Calls.CACHED_NAME, CallLog.Calls.CACHED_PHOTO_ID, etc.
The following profile, when in the coverage area of ​​a specific WiFi AP and calling from a specific number, replaces the entry in the call log with a false one, in which the Date, Duration and Type parameters are the same as for a real call, and the Number and Name are different. Explanations of contexts in the spoiler "Standard Tasker actions"
Profile for conspiracy

Profile: Start Clear (66)
State: Wifi Near [SSID:YOU_SSIDMAC: * Capabilities: * Min. Activate Signal Level: 0 Channel: 0 Toggle Wifi: Off
State: Call [Type: Any Number:+ number ]
Enter: blank (67)
A1: Wait [MS: 0 Seconds: 1 Minutes: 0 Hours: 0 Days: 0]
Exit: clearStart (80)
A1: Profile Status [Name: Clear Call Log Set: On]

Profile: Clear Call Log (68) //For convenience, I left only objects, methods and parameters. All actions except the last - Java Function
Event: Phone Idle
Enter: callLogConsp (53)
A1: cresolv = CONTEXT.getContentResolver (); //Getting ContentResolver
A2: clog = new Calls (); //Class object CallLog.Calls
A3: project = new String [] (4); //Scoop - creating an array of String [] projection
A4: project [0] = clog.NUMBER;
A5: project [1] = clog.DATE;
A6: project [2] = clog.DURATION;
A7: project [3] = clog.TYPE;
A8: select = new String [] (1); //Scoop - an array of one element String [] selection
A9: select [0] = "+ number";//+ number is the number with which the record must be deleted
A10: cur = cresolv.query (clog.CONTENT_URI, project, number = ?, select, null); //Database query
A11: cur.moveToLast ();
A12: vdate = cur.getString (1); //Receive Call Data
A13: vdur = cur.getString (2);
A14: vtype = cur.getString (3);
A15: cresolv.delete (clog.CONTENT_URI, number = ?, select); //Delete selected entry
A16: values ​​= new ContentValues ​​(); //Preparing data to create a fake record
A17: values.put (clog.NUMBER,+ new_number);
A18: values.put (clog.DATE, vdate);
A19: values.put (clog.DURATION, vdur);
A20: values.put (clog.TYPE, vtype);
A21: values.put (clog.CACHED_NAME,New name);
A22: cresolv.insert (clog.CONTENT_URI, values); //Insert a new entry in the Call Log
A23: Profile Status [Name: Clear Call Log Set: Off] //Profile Off
The disadvantage is that my dialer has a smart dial panel, which displays the most frequently used contacts. This task does not remove them from there.

Getting information about missed calls (with pictures) (development)
The task with pictures and introduction elements in java and Java Function for beginners.
Literature
To understand what will be discussed, I recommend reading at least something about java. I used the following sources:
Fayn Yakov Programming in java for children, parents, grandparents. Chapter 3. Pet and fish in java. Chapter 4. Basic constructions of the java language.
Everything is not necessary at once, all the more you can skip the chapters on installing the development environment on a computer, but the chapters mentioned will give a concept about classes, objects and methods.
Goloshchapov Aleksey Google Android: Programming for mobile devices. Chapter 15 SQLite Database and Content Providers
Here you can find information about working with databases in Android, which is what we will do in the task. Well, no one canceled the search on the Internet, the official developer.android.com website and the tasker guide (java section)
Lyrical digression - a little about java
Without pretending to have a complete understanding of java, I’ll try to portray some Introduction Intro for Just Beginners.
Java is classes, objects, and their methods. Class is a set of definitions for an object. These definitions include the attributes of the class that describe its characteristics, and methods (Method) - the actions that the class can perform.
Here, for example, as a fleet program. It consists of two classes of vehicle (Attributes - 4 wheels and an internal combustion engine) and driver (with the attributes of the head and hands). Car techniques - ride, the driver - to drive. In these classes, there are other classes that inherit attributes and methods from the core, but also have their own, for example, to transport goods (method), or have the right to a certain category (attribute). Thus creating classes inheriting characteristics, we will eventually reach the objects - the driver Vasey rights categories A, B and C and VAZ 2106 license plate 212. These objects, interacting methods plant () and Cox (), to be According algorithm navigate waybill.
In Java Function, we will get Android classes, create objects and use their methods for our needs.
Working with Java Function (hereinafter referred to as JF) is working with existing Android classes and methods, you cannot create your own classes, but there is more than enough of what is (if you do not set the goal to create a program - but for this you need not a tasker, but another tool). Android class reference can be foundhere. In general, creating a task using JF does not begin with a tasker, but with a search for information on how to do this in android, picking in the firmware sources (for example, hereGit repositories on android) or decompiled system files, studying ready-made solutions from the network, and only then we go to the tasker. It is unlikely that a task will be created using the method of scientific, and even more so unscientific, poke.
So Action - Code - Java Function
Attached Image

The JF action window contains the following elements
The Class or Object field to select the class or object, respectively, and the Function field to select the methods of the class or object. Controls 1 - Magnific Glass (hereinafter - MG) displays a list of Android classes. 2 - Coffee Cup (hereinafter - CC) - a list of user objects and java variables. 3 The question mark (?) Opens in a browser page on developer.android.com with help on the class or method. Well, the familiar icon for selecting a tasker variable of the form% Value, familiar from the usual actions of the tasker.
Attached Image

The lists have a filter field for quick search for a class or method. A necessary function, because the list of classes is unrealistically large.
Temporarily unfinished
So the challenge.
To get started, we get the number of missed but not viewed calls, i.e. The value that is displayed in the circle on the dialer icon. PS The TelephonyManager.getMissedCallCount () method is not available on all phones (it is definitely not on the official android, but I stumbled upon it by accident). If you do not have this method, we will get it in another way (starting from step A5).
A1: Java Function [Return: aTelephony Class Or Object: CONTEXT Function: getSystemService
{Object} (String) Param: phone Param: Param: Param: Param: Param: Param:]
This is what it looks like in the Export Description.txt format. I will write like this
A1
A1 JF aTelephony = CONTEXT.getSystemService (phone)
so as not to distract attention to unused parameters.
Attached Image

In the field Class or Object, on the CC jump, select the built-in object of the Tasker CONTEXT. (If you just started working with JF, you only have two items on this list. As you move forward, the list will be updated with the results of our actions)
Attached Image
Attached Image

In the Function field, click MG and select the getSystemService () method from the list
Attached Image

The selected method requires a parameter of type String (in parentheses) and returns Object (in braces). After choosing a method, additional Param and Return fields appeared
Attached Image

In the Param field, enter the name of the service - phone. In this way, you can get some other services, a complete list of which can be found in the terminal (terminal emulator) by entering the service list command.
Attached Image

In the Return field, enter the name of the received object
Attached Image

We exit the action window and run the task to get our object for further work.
A2
A2 JF% Count = aTelephony.getMissedCallCount ()

Attached Image
Attached Image
Attached Image

In the second action of the task, in the first field on CC, select our object (TelephonyManager) aTelephony, in the second on MG, select the getMissedCallCount () method, and in the appeared field Return, enter the name of the tasker variable% Count to process it outside JF.
A3
A3 Run Shell Command: nc = $ ((% Count% 100)); nd = $ ((% Count% 10)); if [$ nd -eq 1 -a $ nc -ne 11]; then echo call; elif [$ nd -ge 2 -a $ nd -le 4] && [$ nc -lt 10 -o $ nc -ge 20]; then echo call; else echo calls; fi Store Output in:% Word

Attached Image

This action (no longer JF) allows you to incline the word "call" in accordance with the received number of missed calls, i.e. 1 call, 2 calls. 10 challenges. Formula from hereTasker (Post username11 # 38588249),but the syntax is not understood and created the above monster using the recommendations from the manualA. Solovyova Shell Programming (UNIX)(intrinsically). It would be possible, of course, on a tasker, but the design is no less monstrous, and in the future this script will be needed with some modifications.
Attached Image

A4
A4 Display the message "Missing% Count% Word" in the desired way
On this, I think the graphic accompaniment is unnecessary.
To be continue ..
The fight for a culture of speech
Preliminary preparation
// We use a global variable for the Say action (it can be passed to another task that will only say it out loud), so we clear the array from the previous request
A1 Array Clear Name:% Tospeech
// Prepare The Variable For Yesterday's Date
A2 Variable Set% yesterday to% TIMES-86400 Do Maths: On
A3 Variable Convert% yesterday Function: Seconds to Date Time
// The date format is m-d-Y H.M The next step is to get the date
A4 Variable Search Replace% yesterday Search: (\ d {1,2} - \ d {1,2} - \ d {4}) (\ s) (\ d {2} \. \ D {2}) Replace Matches With: $ 1

Get the number of new missed calls
// Get the ContentResolver to query providers.contacts
A5 JF aCresolv = CONTEXT.getContentResolver ()
// Get our instance of CallLog.Calls
A6 JF aCalls = new Calls ()
// Collect the selection array of 3 elements to select
A7 JF select = new String [] (3)
// Set the filter for numbers. Now it is not required, so we use any character, but then this element will be needed
A8 JF select [0] = "*"
// This is a filter for missed calls - Calls.MISSED_TYPE = 3 constant
A9 JF select [1] = "3"
// Filter for new (Calls.NEW), i.e. calls not viewed by the user
A10 JF select [2] = "1"
// Request to CallLog.Calls -
A11 JF cur = aCresolv.query (aCalls.CONTENT_URI, null, number! =? AND type =? AND new = ?, select, null)
// Get the total number of new missed calls, which is displayed on the dialer icon
A12 JF% mallcount = cur.getCount ()
// Get the column numbers number, name and date
A121 JF% indexnumber = cur.getColumnIndex (aCalls.NUMBER)
A122 JF% indexname = cur.getColumnIndex (aCalls.CACHED_NAME)
A123 JF% indexdate = cur.getColumnIndex (aCalls.DATE)
// Pass the declination options to the pluralForm task. I decided to use this task separately, because you can resort to her help from any other task, passing the necessary parameters - the number and three variants of declension in the plural
A13 Variable Set% plurs to missed call, missed call, missed call
A14 Perform Task pluralForm% par1 =% plurs% par2 =% mallcount Return Value Variable:% Words
// Set the counter to "no" if there are no missing
A15 Variable Set% mallcount to none If% mallcount = 0
// Say the phrase about the number of missed
A16 Say Text: You have% mallcount% Words
// If they are not, stop the task
A17 Stop If% mallcount eq no

Get a list of phone numbers for detailed processing.
// Loop For Each Record Found
A18 For% item items 1:% mallcount (#)
// java arrays begin with element [0]. To move through the selection, create a new variable
A19 Variable Set% count to% mallcount-1 Do Maths: On
// Move the cursor to the appropriate position
A20 JF cur.moveToPosition (% count)
// Field Calls.NUMBER containing the number of the caller
A21 JF% number = cur.getString (% indexnumber)
// Add the number to the Tasker array
A22 Array Push Name:% numberlist Position:% item Value:% number
A23 End For
// Delete duplicates and collect the remaining ones in a bunch
A24 Array Process Variable:% numberlist Type: Remove Duplicates
A25 Array Process Variable:% numberlist Type: Squash

Processing the received list of numbers
// Here we get the values ​​of the Calls.DATE and Calls.CACHED_NAME fields for each number from the received list, which (number) are added to the select array one by one [0]
A26 For% item items 1:% numberlist (#)
A27 JF select [0] = "% numberlist (% item)"
//
A28 JF cur = aCresolv.query (aCalls.CONTENT_URI, null, number =? AND type =? AND new = ?, select, null)
// The number of skipped for this number
A29 JF% numcount = cur.getCount ()
// Move the cursor to the last position to get information about the last call
A30 JF cur.moveToLast ()
// The name of the caller, if recorded in contacts
A31 JF% abonent = cur.getString (% indexname)
// If not (the field is empty, the variable is not set), then insert the number
A32 Variable Set% abonent to% numberlist (% item) If% abonent! Set
// Pass the number of calls from the subscriber and the declension of the word "times" in pluralForm
A33 Variable Set% plurs to times, times, times
A34 Perform Task pluralForm% par1 =% plurs% par2 =% numcount Return Variable Value:% Words
// Start composing a phrase
A35 Variable Set% phrase to Subscriber% abonent called% numcount% Words
// If there are several calls, we add that infa is only about the last call. Before the variable value (last time), put a space
A36 Variable Set% phrase to last time Append: On If% numcount>1
// Information about the date of the call in milliseconds
A37 JF% getdate = cur.getString (% indexdate)
// Trim To 10 Characters To Get Seconds
A38 Variable Section% getdate from 1 lenght 10
// Variable% delta - the number of days elapsed since the call
A39 Variable Set% delta to floor ((% TIMES-% getdate) / 86400) Do Maths: On
// Translate seconds into humanreadable format d-m-Y H.M
A40 Variable Convert% getdate Function: Seconds to Date Time
// Get only the time from the date. Tasker stores the search results in an array, even if there is only one match, so our variable will be% lasttime1
A41 Variable Search Replace% getdate Search: (\ d {2} \. \ D {2}) Store Matches in:% lasttime
// Send to pluralForm the number of days and the confusing phrase
A42 Variable Set% plurs to a day ago, days ago, days ago
A43 Perform Task pluralForm% par1 =% plurs% par2 =% delta Return Variable Value:% Words
// Set the value for the call date - how many days ago
A44 Variable Set% lastdate to% delta% Words
// If the call was today - this is how we arrange
A45 Variable Set% lastdate to today If% getdate ~% DATE *
// Same for yesterday (see at the very beginning)
A46 Variable Set% lastdate to yesterday If% getdate ~% yesterday
// Add date to the phrase. Do not forget about the gap ahead
A47 Variable Set% phrase to% lastdate Append: On
// Add the time if the call was today or yesterday. For earlier dates, omit time
A48 Variable Set% phrase to in% lasttime1 If% delta<2
// Add the phrase to the tasker array. You can, of course, lose immediately, but you can glue all phrases with a comma (,) and pass them to the task that deals with pronunciation. In my opinion, if there are more than one task with voice output, it’s nice to highlight one special task for this
A49 Array Push Name:% Tospeech Position:% item Value:% phrase
A50 End For

We pronounce the received phrases in a cycle
A51 For% item items 1:% Tospeech (#)
A52 Sound signal to choose between phrases
A53 Say Text:% Tospeech (% item)
A54 end for

Zero the counter of new missed
// Return select filter for all numbers
A55 JF select [0] = "*"
// Organize the value 0 to update the Calls.NEW field
A56 JF values ​​= new ContentValues ​​()
A57 JF values.put (aCalls.NEW, 0)
// Actually, we reset the counter for the selected records
A58 JF aCresolv.update (aCalls.CONTENT_URI, values, number! =? AND type =? AND new = ?, select, null)

PluralForm task for declination
A1 Variable Split% par1 Splitter, (comma)
A2 Run Shell Command: nc = $ ((% par2% 100)); nd = $ ((% par2% 10)); if [$ nd -eq 1 -a $ nc -ne 11]; then echo% par11; elif [$ nd -ge 2 -a $ nd -le 4] && [$ nc -lt 10 -o $ nc -ge 20]; then echo% par12; else echo% par13; fi Store Output in:% Words

Changes
06/13/2017 Changes in the settings $ secure section
Earlier
- Changes in settings, flashlight on JF
- Disable SIM (settings)
- A little settings
- Added missed call notification with name
- Perezalit file with the article Solovyov
- Added vibration tracking script


Post has been editedslax - 08.07.17, 16:52
Reason for editing: Settings $ secure section



Rep: (44)
This is not a problem with variable query. In the tusker, everything works like a clock, it seems, but with the application - it's a disaster.
Hotelka
Each (day of the week) clean the folder with pictures, video, audio and documents of Telegram messenger.

What is done
Telerase (24)
A1: If [% FrstL! Set]
A2: Variable Query [Title: Enter the path to the device memory in the format
/ mnt / store Variable:% DIRTEL Input Type: Normal Text Default: / Background Image: Layout: Variable Query Timeout (Seconds): 600 Show Over Keyguard: On]
A3: Wait [MS: 100 Seconds: 0 Minutes: 0 Hours: 0 Days: 0]
A4: Variable Query [Title: What days to clean? Variable:% DWT Input Type: Normal Text Default: Sunday Background Image: Layout: Variable Query Timeout (Seconds): 40 Show Over Keyguard: On]
A5: Wait [MS: 100 Seconds: 0 Minutes: 0 Hours: 0 Days: 0]
A6: Variable Query [Title: How many hours to clear? Variable:% HWT Input Type: Normal Text Default: Background Image: Layout: Variable Query Timeout (Seconds): 600 Show Over Keyguard: On]
A7: Wait [MS: 100 Seconds: 0 Minutes: 0 Hours: 0 Days: 0]
A8: Variable Query [Title: How many minutes to clear? Variable:% MWT Input Type: Normal Text Default: Background Image: Layout: Variable Query Timeout (Seconds): 600 Show Over Keyguard: On]
A9: Wait [MS: 100 Seconds: 0 Minutes: 0 Hours: 0 Days: 0]
A10: Variable Set [Name:% FrstL To: 1 Do Maths: Off Append: Off]
A11: End If
A12: Wait Until [MS: 0 Seconds: 0 Minutes: 0 Hours: 0 Days: 8] If [% DAYW eq% DWT]
A13: Wait [MS: 0 Seconds: 0 Minutes:% MWT Hours:% HWT Days: 0]
A14: Run Shell [Command: rm -R% DIRTEL / Telegram Timeout (Seconds): 0 Use Root: Off Store
A15: Vibrate [Time: 200]

Application -https://yadi.sk/d/zPbtxI07hoz2V
Problem - Variable Query starts to be odd, at first it's normal, I just enter the data, but then it starts to ask again just a way a lot of times, and then everything all over again, and only after a minute it finally swipes and vibrates, notifying abouthopelessnessdeleting files.

Attached files

Attached fileTelerase.4.apk(1.87 MB)


Post has been editedusername11 - 21.05.17, 20:04
Reason for editing: removed link to non-existent post



Rep: (11)
all geocoding.
geocode.js:
var maxresults = 10;

var res = JSON.parse (global ('HTTPD'));

if (res.results.length>maxresults) {res.results.length = maxresults; }

var outaddress = new Array (res.results.length);
var outlat = new Array (res.results.length);
var outlng = new Array (res.results.length);

for (var i = 0; i<res.results.length; i ++) {
outaddress [i] = res.results [i] .formatted_address;
outlat [i] = res.results [i] .geometry.location.lat;
outlng [i] = res.results [i] .geometry.location.lng;
}


after running this script, there is nothing in outaddress1 (HTML Popup displays the variable name% outaddress1,% HTTPD displays the response in JSON format). maybe you need to somehow pass the variables to the tasker?
well, right away: how to call a dialog after executing a script in which you can select an address and then execute the script based on the choice?

upd. 1 question disappears, you need this: var res = JSON.parse (global ('HTTPD')); - fixed in a post

Post has been editedalegzz - 12.07.15, 10:31



Rep: (842)
Will anyone tell me where to find the color codes for the sims that are set in the settings?
I understand that there are more colors than off
Attached Image

https: //www.google.com...ml#color-color-palette

Post has been editedsergr59 - 12.07.15, 13:10



Rep: (825)
* sergr59,
Pomeranch - # fffe7214
Zelenka - # ff34b800



Rep: (2511)
* sergr59 , pick up the resources of Android, then look for colors in the same spirit as is done in the "basics".
* egorg2003 , replace Variable Query with the scene.
* alegzz , after the end of the script in Tasker, you will have three arrays:% outaddress,% outlat,% outlng, use the Menu action, for example, or a scene.

Post has been editedusername11 - 30.07.17, 12:10



Rep: (4)
* username11, launches a task switching% DEBUG_START_SENSOR in on / off, and pauses between each change in value 5c (tried various values ​​50ms / 100ms / 250 / 1c / 15c /, ..., a visible result is not affected). It appears that when the% DEBUG_START_SENSOR not recomputed state of the proximity sensor, as variables see how the on to off or vice versa, and% DEBUG_START_TIME does not change. % DEBUG_START_TIME changes only if at the time when the% DEBUG_START_SENSOR = on, cover the sensor. Those. it looks as if the task starts the context that changes the state of the sensor. If at the time of switching% DEBUG_START_SENSOR in on the sensor is covered, the task does not run (despite the fact that the profile of state Proximity context, with state Not Proximity situation is completely analogous).
1st log - 5 cycles of% DEBUG_START_SENSOR change with a covered sensor before testing, 2nd - 5 cycles of% DEBUG_START_SENSOR changes with a periodic sensor cover, 3rd - a call with a covered sensor before the call, 4th - a periodic call sensor cover.
Attached filelogs.zip(53.29 KB)
the archive contains four logcat logs - a total of 716 KB of text, so zip.
Profile from 1st and 2nd logs:
Profile: Test1 (29)
State: Variable Value [% DEBUG_START_SENSOR ~ on]
State: Proximity Sensor
Enter: Test1 (30)
A1: Variable Set [Name:% DEBUG_START_TIME To:% TIMEMS Do Maths: Off Append: Off]

The task for testing this profile (started and stopped manually):
Test2 (31)
A1: Wait [MS: 0 Seconds: 5 Minutes: 0 Hours: 0 Days: 0]
A2: Variable Set [Name:% DEBUG_START_SENSOR To: on Do Maths: Off Append: Off]
A3: Wait [MS: 0 Seconds: 5 Minutes: 0 Hours: 0 Days: 0]
A4: Variable Set [Name:% DEBUG_START_SENSOR To: off Do Maths: Off Append: Off]
A5: Goto [Type: Action Number Number: 1 Label:]

Profile from the 3rd and 4th log:
Profile: Test1 (29)
State: Call [Type: Incoming Number: *]
State: Proximity Sensor
Enter: Test1 (30)
A1: Variable Set [Name:% DEBUG_START_TIME To:% TIMEMS Do Maths: Off Append: Off]

the file name of each log is the time when the log was removed. Understand where a log can be by this name, because the logs were removed in the order of the tests.
During the testing time for the 1st and 3rd of the log before the tests covered finger sensor, ie, "State: Proximity Sensor" was supposed to be true all the time, because during testing time changed only "State: Variable Value [% DEBUG_START_SENSOR ~ on]" for the 1st and the "State: Call [Type: Incoming Number: *]" for the third. Ie, Task1 in the first test should have been executed 5 times, instead of 1 (in the third test, most likely, Task1 would have worked only once, if I closed the sensor and made a few calls without opening the sensor). I think this behavior is criminal.
If the sensor polling settings are set to No, then generally it does not work after turning off the screen, if Yes, then it works for 15 seconds normally, and then with a noticeable delay, if Keep Awake, then it is as normal as when the screen is on (even Stamina with Keep Awake said that the tasker does not allow the device to fall asleep, despite the fact that the tasker was added to the exceptions). Here the results are in line with expectations.

Post has been editedusername11 - 30.07.17, 11:54
Reason for editing: merged posts



Rep: (842)
I’m trying to understand how to adjust the size of the scene for different screens.
I read "OSM" I read I read. And I do not catch up: blush:.
"A scene is a graphical user interface consisting of a set of" triggered "elements in a task, for example by clicking on them."
As I see when I make a scene, this is a substrate / base with a grid of the size we need on which we can place / fit elements. And this substrate has dimensions, the elements are the same. Substrate size m. larger than the size of the element, but not vice versa.
Through the Create Scene action, you can then resize the elements of the finished scene before its Show, right?
But the dimensions of the substrate itself are not? If not, then if I create a scene for a screen with a higher resolution, then this background will not fit on the screen with a lower resolution. Elements of the scene can be adjusted depending on the character of the screen, but with the background it is not clear.
I read it again first.
Attached Image
Attached Image


Post has been editedsergr59 - 12.07.15, 22:09



Rep: (137)
then this substrate will not fit on the screen with a lower resolution

Not so bad;) I have a 854 * 480 screen, i.e. 1.5 times less in resolution than 1280 * 720.
I made a scene with a size of 480 * 100 and a rectangle of 480 * 50. Made an export to xml. Found a file in the Tasker / scenes folder. I changed the sizes to 720 * 150 and 720 * 75 and saved. I did the xml import, and showed the scene with the Show Scene action. And everything was fine, Tasker simply scaled the scene 1.5 times down: D
Try to make a scene for the 1920 * 1080 screen, the same should happen.
P.S. after exporting a scene with a higher resolution than the screen, you cannot enter the scene editor, Tasker does not like this and it automatically reduces the size.
Option: make several different scenes for different resolutions. And show the desired one depending on the result of the Test Display action.
I think there are enough 3 scenes for the main resolutions, i.e. for 854 * 480, 1280 * 800 and 1920 * 1080 pixels.

Post has been editedusername11 - 21.05.17, 20:19
Reason for editing: merged posts



Rep: (842)
* Nukri, No, I think it is not correct, there is something that we do not understand.
It is necessary to read again the basics scenes. Excellence (OCM).
A set of six generalized densities:
ldpi (low) ~ 120dpi
mdpi (medium) ~ 160dpi
hdpi (high) ~ 240dpi
xhdpi (extra-high) ~ 320dpi
xxhdpi (extra-extra-high) ~ 480dpi
xxxhdpi (extra-extra-extra-high) ~ 640dpi

If dpi = 160, px = (dpi / 160) * dp, then px = (160/160) * dp, ie px = 1dp
if dpi = 320, px = (dpi / 160) * dp, then px = (320/160) * dp, i.e. px = 2dpmy screen
I created a scene*with a size of 720 * 1280 by which the size of the element 720 * 240
Then mdpi screen (160dpi) my scene should be reduced in 2 times? The item can be, as well as the substrate can be reduced Tasker actions?
Attached Image

...... in thought

Post has been editedsergr59 - 13.07.15, 10:14



Rep: (2511)
sergr59 @ 12.07.2015, 21:45*
I read "OSM" Chita. And not doganyayu
"A scene is a graphical user interface consisting of a set of" triggered "elements in a task, for example by clicking on them."

I did not write! I may sometimes clumsily expressed, but certainly not enough. This is where it? I look in of.rukovovdstvo:
A scene is a graphical user-interface consisting of a collection of elements to which tasks can be attached to be run when the user interacts with them e.g. by tapping them.

"The scene is a kind of graphical user interface consists of a set of elements, which may be associated problems start when the user interacts with them, such as clicks on them." And do not laugh! The English version sounds in English no less ugly than my crib. And yes, press not the problem, but on the elements. And yes, in English it sounds exactly the same: the user clicks on the task. In general, "the scene - a version of the graphical user interface is composed of the elements of the scene element, you can assign the task Tasker, this problem starts when a user interacts with an element, for example, clicks on it.". Something like that, although it would be necessary to edit another. You can now translate into English. : D
Okay. Tasker knows scene aspect ratio, i.e., ratio of width and height. He will stretch / compress it to a particular screen, then you can get the scene size and recalculate the dimensions of the elements. Ah, "heavy and clumsy life of a simple programmer!"*Not, dpi is needed to create a scene that looks "right." dpi is also required, if the scene is an element that has a minimum size. For example, in a scene from WIFIbar bases such an element could be a sign - Text element. If you hold down the size not less than a certain threshold, it will have to make a scene WIFIbar longer (with a margin), and the elements in the drawing of the scene, for example, at the bottom in the middle. Clear. I wanted to say? Generally,Nukri at * It has announced the remaining options.

Post has been editedusername11 - 30.07.17, 11:56



Rep: (71357)
tasker v4.7u2
What's new
13/07/2015:
- attempted bufixes: for some errors reported via developer console
- bugfix: spurious warning about moving autobackups
- bugfix: was not handling no restore options being available
- bugfix: app creation: file: // icon URIs were causing creation to fail
- added: action Interrupt Mode: Continue On Eror option

Attached fileTasker_4.7u2.apk(3.15 MB)
Attached fileTasker_4.7u2m.apk(3.15 MB)


Post has been editedAlex0047 - 13.07.15, 16:28


Full version    

Help     rules

Time is now: 25/09/20, 11:17