Java refers to Tasker's advanced Java integration features, which allow users to access Android APIs, create and manipulate Java objects, and execute Java-based automation logic. Tasker provides two primary mechanisms for Java integration: Java Function and Java Code.
These features enable advanced users to interact directly with Android's underlying framework and perform actions that may not be available through standard Tasker actions.
Android is built primarily on Java-based APIs. To provide access to the full Android framework, Tasker includes tools that allow users to call Java methods, work with Android classes, create objects, and execute custom scripts.
Tasker's Java features bridge the gap between traditional Tasker automation and Android application development.
Java Function allows users to call individual Java methods and create Java objects directly from a Tasker task.
Features include:
Calling Android API methods
Creating Java objects
Accessing object fields
Using Android system services
Working with arrays and collections
Storing Java objects for later use
Java Function is intended for structured interaction with Android APIs without writing source code.
Example:
Variable Set %service wifi
Java Function wiman = CONTEXT.getSystemService(%service)
Java Function %enabled = wiman.isWifiEnabled()
Java Code allows users to write and execute multi-line Java-like scripts using the BeanShell interpreter.
Features include:
Multi-line scripting
Variables and functions
Loops and conditions
Android API access
Notification monitoring
Accessibility integration
HTTP requests
JSON processing
Reactive programming
Java Code provides significantly more flexibility than Java Function and is intended for complex automation scenarios.
Example:
ssid = tasker.getVariable("SSID");
tasker.showToast("Connected to " + ssid);
return ssid;
Tasker can store Java objects between actions.
Objects with lowercase names are available only within the current task.
Example:
wifiManager
myArray
Objects containing uppercase characters are available across tasks.
Example:
sharedList
wifiManagerGlobal
Global objects remain in memory until cleared or Tasker is restarted.
Tasker provides several built-in Java objects.
An Android Context object used to access Android system services and APIs.
A Bitmap object used by Tasker's image-related actions.
A Context object available inside Java Code scripts.
A helper object available inside Java Code that provides functions for interacting with Tasker.
Tasker's Java features provide access to large portions of the Android framework, including:
Wi-Fi services
Bluetooth services
Notifications
Accessibility services
Content providers
Broadcast receivers
Activities
Sensors
Media services
This allows automations to interact with Android features that may not have dedicated Tasker actions.
Java integration can interact directly with Tasker variables.
Supported operations include:
Reading variables
Writing variables
Creating Java variables
Sharing Java objects between actions
Passing parameters to tasks
Java Code provides helper functions such as:
getVariable()
setVariable()
getJavaVariable()
setJavaVariable()
callTask()
sendCommand()
Java objects may be created using constructors or factory methods.
Example:
Java Function list = new ArrayList()
Arrays are also supported.
Example:
Java Function arr = new String[](10)
Tasker supports object casting to specify an object's type.
Example:
(WifiManager) wiman
Casting allows Tasker to expose methods associated with the specified class.
Tasker's Java Code action includes an AI Code Helper capable of generating Java scripts from natural language descriptions.
Users may generate code directly within Tasker or export instructions for use with external AI systems.
Java Code includes support for selected libraries.
Used for web requests and API communication.
Used for image loading and image processing.
Used for asynchronous operations, event streams, timers, and reactive programming.
Tasker's Java features are commonly used for:
Advanced Android automation
API integration
Network communication
Notification monitoring
Accessibility automation
File management
JSON processing
UI interaction
Android system service access
Java Function executes one method call per action.
Java Code uses BeanShell rather than modern Java.
Some Android APIs require permissions unavailable to Tasker.
Certain APIs require an Activity context.
Java Code does not support modern Java features such as lambdas, streams, or generic syntax.
Feature
Java Function
Java Code
Create Objects
Yes
Yes
Call Android APIs
Yes
Yes
Multi-line Logic
No
Yes
Loops
No
Yes
Conditions
Limited
Yes
Third-Party Libraries
No
Yes
Reactive Programming
No
Yes
AI Code Generation
No
Yes
Java integration has long been considered one of Tasker's most powerful advanced features. It enables users to extend Tasker's capabilities beyond built-in actions and provides direct access to the Android framework without requiring the development of a separate Android application.
Tasks
Variables
Projects
App Factory
Tasker AI Generator
Android API
Accessibility Service
Notification Listener
Widget v2