public class

LL

extends Object
java.lang.Object
   ↳ net.pierrox.lightning_launcher.script.api.LL

This class is deprecated.
check alternatives on each function.

Class Overview

The main object to access Lightning Launcher features. The LL object gives access to desktops, items or give contextual data on the event.

Summary

Public Methods
boolean bindClass(String name)
This method is deprecated. use bindClass(String) instead
LL.bindClass(name) -> bindClass(name)
ImageAnimation createAnimation(int width, int height, int count, int duration, int loopCount)
This method is deprecated. use createAnimation(int, int, int, int, int) instead
LL.createAnimation(width, height, count, duration, loopCount) -> Image.createImage(width, height, count, duration, loopCount)
ImageBitmap createImage(int width, int height)
This method is deprecated. use createImage(int, int) instead
LL.createImage(width, height) -> Image.createImage(width, height)
Image createImage(String path)
This method is deprecated. use createImage(String) instead
LL.createImage(path) -> Image.createImage(path)
Image createImage(String pkg, String name)
This method is deprecated. use createImage(String, String) instead
LL.createImage(pkg, name) -> Image.createImage(pkg, name)
ImageScript createImage(Scriptable object, int width, int height)
This method is deprecated. use createImage(Scriptable, int, int) instead
LL.createImage(object, width, height) -> Image.createImage(object, width, height)
Script createScript(String name, String text, int flags)
This method is deprecated. use createScript(String, String, int) instead
LL.createScript(name, text, flags) -> createScript(name, text, flags)
ImageBitmap cropImage(ImageBitmap image, boolean full_size)
This method is deprecated. use cropImage(ImageBitmap, boolean) instead together with an ActivityScreen
LL.cropImage(image, full_size) -> 'cropImage' in getActiveScreen() ? getActiveScreen().cropImage(image, full_size) : null
void deleteScript(Script script)
This method is deprecated. use deleteScript(Script) instead
LL.deleteScript(script) -> deleteScript(script)
Array getAllDesktops()
This method is deprecated. use getAllDesktops() instead together with getConfiguration() (Difference: returns a java array instead of Array, convert if necessary)
LL.getAllDesktops() ~> getConfiguration().getAllDesktops()
Array getAllScriptMatching(int flags)
This method is deprecated. use getAllScriptMatching(int) (Difference: returns a java array instead of Array, convert if necessary)
LL.getAllScriptMatching(flags) ~> getAllScriptMatching(flags)
Container getContainerById(int id)
This method is deprecated. use getContainerById(int) instead with a Screen
LL.getContainerById(id) -> getEvent().getScreen().getContainerById(id)
Context getContext()
This method is deprecated. use getContext() instead with a Screen
LL.getContext() -> getActiveScreen().getContext()
Desktop getCurrentDesktop()
This method is deprecated. use getCurrentDesktop() instead together with getActiveScreen()
LL.getCurrentDesktop() -> getActiveScreen().getCurrentDesktop()
Script getCurrentScript()
This method is deprecated. use getCurrentScript() instead
LL.getCurrentScript() -> getCurrentScript()
Desktop getDesktopByName(String name)
This method is deprecated. use getDesktopByName(String) instead together with getHomeScreen()
LL.getDesktopByName(name) -> getHomeScreen().getDesktopByName(name)
Event getEvent()
This method is deprecated. use getEvent() instead
LL.getEvent() -> getEvent()
Desktop getFloatingDesktop()
This method is deprecated. use getContainerById(int) instead together with getFloatingDesktopId()
LL.getFloatingDesktop(); -> getFloatingScreen().getContainerById(getConfiguration().getFloatingDesktopId())
Desktop getHomeDesktop()
This method is deprecated. use getContainerById(int) instead together with getHomeDesktopId()
LL.getHomeDesktop() -> getHomeScreen().getContainerById(getConfiguration().getHomeDesktopId()) (note: in some rare cases getHomeScreen() may return null. If necessary consider searching on getBackgroundScreen() as an alternative)
Item getItemById(int id)
This method is deprecated. use getItemById(int) instead together with a Screen
LL.getItemById(id) -> getEvent().getScreen().getItemById(id)
Desktop getLockscreenDesktop()
This method is deprecated. use getContainerById(int) instead together with getLockscreenDesktopId()
LL.getLockscreenDesktop() -> getLockScreen().getContainerById(getConfiguration().getLockscreenDesktopId()) (note: in most cases getLockScreen() may return null. If necessary consider searching on getHomeScreen() or getBackgroundScreen() as an alternative)
Array getOpenFolders()
This method is deprecated. use getOpenFolders() instead together with getActiveScreen() (Difference: returns a java array instead of Array, convert if necessary)
LL.getOpenFolders() ~> getActiveScreen().getOpenFolders()
Script getScriptById(String id)
This method is deprecated. use getScriptById(String) instead
LL.getScriptById(id) -> getScriptById(id)
Script getScriptByName(String name)
This method is deprecated. use getScriptByName(String) instead
LL.getScriptByName(name) -> getScriptByName(name)
String getScriptTag()
This method is deprecated. use getTag() instead together with getCurrentScript()
LL.getScriptTag() -> getCurrentScript().getTag()
VariableSet getVariables()
This method is deprecated. use getVariables() instead
LL.getVariables() -> getVariables()
void goToDesktop(int id)
This method is deprecated. use goToDesktop(int) instead together with getHomeScreen()
LL.goToDesktop(id) -> getHomeScreen().goToDesktop(id)
void goToDesktopPosition(int id, float x, float y)
This method is deprecated. use goToDesktopPosition(int, float, float) instead together with getHomeScreen()
LL.goToDesktopPosition(id, x, y) -> getHomeScreen().goToDesktopPosition(id, x, y)
void goToDesktopPosition(int id, float x, float y, float scale, boolean animate)
This method is deprecated. use goToDesktopPosition(int, float, float, float, boolean) instead together with getHomeScreen()
LL.goToDesktopPosition(id, x, y, scale, animate) -> getHomeScreen().goToDesktopPosition(id, x, y, scale, animate)
boolean isLocked()
This method is deprecated. use isLocked() instead
LL.isLocked() -> isLocked()
boolean isPaused()
This method is deprecated. use isPaused() instead together with getHomeScreen() (difference: this function returns false if any screen is not paused, not only the HomeScreen. For an exact substitute check all the other screens too)
LL.isPaused(tag) ~> getHomeScreen().isPaused()
String loadRawResource(String pkg, String name)
This method is deprecated. use loadRawResource(String, String) instead
LL.loadRawResources(pkg, name) -> loadRawResources(pkg, name)
int pickColor(String title, int color, boolean hasAlpha)
This method is deprecated. use pickColor(String, int, boolean) instead together with an ActivityScreen
LL.pickColor(title, color, hasAlpha) -> 'pickColor' in getActiveScreen() ? getActiveScreen().pickColor(title, color, hasAlpha) : 0
Image pickImage(int maxPixels)
This method is deprecated. use pickImage(int) instead together with an ActivityScreen
LL.pickImage(maxPixels) -> 'pickImage' in getActiveScreen() ? getActiveScreen().pickImage(maxPixels) : null
float pickNumericValue(String title, float value, String valueType, float min, float max, float interval, String unit)
This method is deprecated. use pickNumericValue(String, float, String, float, float, float, String) instead together with an ActivityScreen
LL.pickNumericValue(title, value, valueType, min, max, interval, unit) -> 'pickNumericValue' in getActiveScreen() ? getActiveScreen().pickNumericValue(title, value, valueType, min, max, interval, unit) : 0
void runAction(int action, Item item, String data)
This method is deprecated. use runAction(int, Item, String) instead together with a Screen
LL.runAction(action, item, data) -> getEvent().getScreen().runAction(action, item, data)
void runAction(int action, String data)
This method is deprecated. use runAction(int, String) instead together with a Screen
LL.runAction(action, data) -> getEvent().getScreen().runAction(action, data)
void runAction(int action)
This method is deprecated. use runAction(int) instead together with a Screen
LL.runAction(action) -> getEvent().getScreen().runAction(action)
void runScript(String name, String data)
This method is deprecated. use runScript(String, String) instead together with a Screen
LL.runScript(name, data) -> getEvent().getScreen().runScript(name, data)
void save()
This method is deprecated. use save() instead
LL.save() -> save()
boolean sendTaskerIntent(TaskerIntent intent, boolean synchronous)
This method is deprecated. use sendTaskerIntent(TaskerIntent, boolean) instead
LL.sendTaskerIntent(intent, synchronous) -> sendTaskerIntent(intent, synchronous)
void setScriptTag(String tag)
This method is deprecated. use setTag(String) instead together with getCurrentScript()
LL.setScriptTag(tag) -> getCurrentScript().setTag(tag)
void setVariableBoolean(String name, boolean value)
This method is deprecated. use setVariableBoolean(String, boolean) instead
LL.setVariableBoolean(name, value) -> setVariableBoolean(name, value)
void setVariableFloat(String name, float value)
This method is deprecated. use setVariableFloat(String, float) instead
LL.setVariableFloat(name, value) -> setVariableFloat(name, value)
void setVariableInteger(String name, long value)
This method is deprecated. use setVariableInteger(String, long) instead
LL.setVariableInteger(name, value) -> setVariableInteger(name, value)
void setVariableString(String name, String value)
This method is deprecated. use setVariableString(String, String) instead
LL.setVariableString(name, value) -> setVariableString(name, value)
boolean startActivity(Intent intent)
This method is deprecated. use startActivity(Intent) instead together with getActiveScreen()
LL.startActivity(intent) -> getActiveScreen().startActivity(intent)
boolean startActivityForResult(Intent intent, Script receiver, String token)
This method is deprecated. use startActivityForResult(Intent, Script, String) instead together with an ActivityScreen
LL.startActivityForResult(intent, receiver, token) -> 'startActivityForResult' in getActiveScreen() ? getActiveScreen().startActivityForResult(intent, receiver, token) : false
void unlock()
This method is deprecated. use unlock() instead
LL.unlock() -> unlock()
void writeToLogFile(String data, boolean append)
This method is deprecated. use writeToLogFile(String, boolean) instead
LL.writeToLogFile(data, append) -> writeToLogFile(data, append)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean bindClass (String name)

This method is deprecated.
use bindClass(String) instead
LL.bindClass(name) -> bindClass(name)

Translate a Java class into a JavaScript object. This is a convenience method that avoid repeated use of fully qualified names while scripting Java.

Parameters
name fully qualified class name
Returns
  • true if the operation succeeded, false if the class cannot be loaded or if already bound

public ImageAnimation createAnimation (int width, int height, int count, int duration, int loopCount)

This method is deprecated.
use createAnimation(int, int, int, int, int) instead
LL.createAnimation(width, height, count, duration, loopCount) -> Image.createImage(width, height, count, duration, loopCount)

Create a blank animation: frames are created fully transparent and need to be drawn. Notes: animations created this way are memory expensive and cannot be persisted (yet). This means that Shortcut.setCustomIcon() wont't work, but Shortcut.setImage() will.

Parameters
width image width
height image height
count number of frames to allocate
duration default frame duration
loopCount initial number of loops to play, use 0 for infinite
Returns
  • an animation or null in case of error (most likely out of memory)

public ImageBitmap createImage (int width, int height)

This method is deprecated.
use createImage(int, int) instead
LL.createImage(width, height) -> Image.createImage(width, height)

Create a blank new image of the specified size. Pixel format is always ARGB 8888. Take care when creating images since it can rapidly exhaust memory and lead to a crash.

Returns
  • can return null if not enough memory

public Image createImage (String path)

This method is deprecated.
use createImage(String) instead
LL.createImage(path) -> Image.createImage(path)

Create an image from the specified file.

Parameters
path path of the image
Returns
  • can return null if an image cannot be read from the file (not an image or not enough memory)

public Image createImage (String pkg, String name)

This method is deprecated.
use createImage(String, String) instead
LL.createImage(pkg, name) -> Image.createImage(pkg, name)

Create an image from a package and a resource name. For instance: LL.createImage("net.pierrox.lightning_launcher_extreme", "icon") The density used is either the one given by ActivityManager.getLauncherLargeIconDensity if available, or the current one.

Parameters
pkg name of the package, use "android" to access system resources.
name name of the drawable resource
Returns
  • can return null if an image cannot be read from the package (unknown package, wrong resource name or not enough memory)

public ImageScript createImage (Scriptable object, int width, int height)

This method is deprecated.
use createImage(Scriptable, int, int) instead
LL.createImage(object, width, height) -> Image.createImage(object, width, height)

Create an image whose content is drawn using a script. This can be used for memory efficient graphics and animations. Please refer to ImageScript for the documentation on how to use it.

Parameters
object the set of functions
width the prefered image width, use -1 for as big as possible
height the prefered image height, use -1 for as big as possible

public Script createScript (String name, String text, int flags)

This method is deprecated.
use createScript(String, String, int) instead
LL.createScript(name, text, flags) -> createScript(name, text, flags)

Create a new script. Use this API wisely.

public ImageBitmap cropImage (ImageBitmap image, boolean full_size)

This method is deprecated.
use cropImage(ImageBitmap, boolean) instead together with an ActivityScreen
LL.cropImage(image, full_size) -> 'cropImage' in getActiveScreen() ? getActiveScreen().cropImage(image, full_size) : null

Request the user to select an area in the image. Warning: because images need to be persisted to file while cropping, this method may be slow.

Parameters
image image to be cropped
full_size handling big images can be slow or request too much memory, by setting full_size to false this will allow this method to downscale images (approx. the size of the screen)
Returns
  • a cropped image, or null if the operation failed or the user canceled it

public void deleteScript (Script script)

This method is deprecated.
use deleteScript(Script) instead
LL.deleteScript(script) -> deleteScript(script)

Delete a script.

public Array getAllDesktops ()

This method is deprecated.
use getAllDesktops() instead together with getConfiguration() (Difference: returns a java array instead of Array, convert if necessary)
LL.getAllDesktops() ~> getConfiguration().getAllDesktops()

Returns an array of desktop identifiers.

public Array getAllScriptMatching (int flags)

This method is deprecated.
use getAllScriptMatching(int) (Difference: returns a java array instead of Array, convert if necessary)
LL.getAllScriptMatching(flags) ~> getAllScriptMatching(flags)

Return the collection of scripts matching some flags.

Parameters
flags see Script#FLAG_*

public Container getContainerById (int id)

This method is deprecated.
use getContainerById(int) instead with a Screen
LL.getContainerById(id) -> getEvent().getScreen().getContainerById(id)

Returns a container by its id.

public Context getContext ()

This method is deprecated.
use getContext() instead with a Screen
LL.getContext() -> getActiveScreen().getContext()

Return the Android Context this script is linked with (an activity context). This is meant to be used with Android services.

public Desktop getCurrentDesktop ()

This method is deprecated.
use getCurrentDesktop() instead together with getActiveScreen()
LL.getCurrentDesktop() -> getActiveScreen().getCurrentDesktop()

Returns the currently displayed desktop.

public Script getCurrentScript ()

This method is deprecated.
use getCurrentScript() instead
LL.getCurrentScript() -> getCurrentScript()

Retrieve the currently executed script.

public Desktop getDesktopByName (String name)

This method is deprecated.
use getDesktopByName(String) instead together with getHomeScreen()
LL.getDesktopByName(name) -> getHomeScreen().getDesktopByName(name)

Returns a desktop by its name, as set in the "Configure desktop" screen. The desktop name can be retrieved using getName(). This method will return null if no desktop by that name can be found

Parameters
name name of the desktop

public Event getEvent ()

This method is deprecated.
use getEvent() instead
LL.getEvent() -> getEvent()

Returns the event object associated with this script execution. The event provides contextual data, such as the current desktop, which item has been tapped, and so on.

public Desktop getFloatingDesktop ()

This method is deprecated.
use getContainerById(int) instead together with getFloatingDesktopId()
LL.getFloatingDesktop(); -> getFloatingScreen().getContainerById(getConfiguration().getFloatingDesktopId())

Returns the desktop used as the floating desktop, or null if not set.

public Desktop getHomeDesktop ()

This method is deprecated.
use getContainerById(int) instead together with getHomeDesktopId()
LL.getHomeDesktop() -> getHomeScreen().getContainerById(getConfiguration().getHomeDesktopId()) (note: in some rare cases getHomeScreen() may return null. If necessary consider searching on getBackgroundScreen() as an alternative)

Returns the home desktop. As of Lightning V14, this method looks for the desktop in the home screen, then in the background desktop.

public Item getItemById (int id)

This method is deprecated.
use getItemById(int) instead together with a Screen
LL.getItemById(id) -> getEvent().getScreen().getItemById(id)

Returns an item by its id. This is a shortcut avoiding to traverse the list of all desktops and folders.

Parameters
id item identifier
Returns
  • an item, or null if this id is not known.

public Desktop getLockscreenDesktop ()

This method is deprecated.
use getContainerById(int) instead together with getLockscreenDesktopId()
LL.getLockscreenDesktop() -> getLockScreen().getContainerById(getConfiguration().getLockscreenDesktopId()) (note: in most cases getLockScreen() may return null. If necessary consider searching on getHomeScreen() or getBackgroundScreen() as an alternative)

Returns the desktop used as the lock screen, or null if not set. As of Lightning V14, this method looks for the desktop in the lock screen, then in the home screen, and finally in the background desktop.

public Array getOpenFolders ()

This method is deprecated.
use getOpenFolders() instead together with getActiveScreen() (Difference: returns a java array instead of Array, convert if necessary)
LL.getOpenFolders() ~> getActiveScreen().getOpenFolders()

Returns the list of currently open folders. This function returns the opener item, not the container itself. This method will return null when the script is executed in the background.

Returns
  • an Array of Folder items, sorted top to bottom (topmost folder is at index 0).

public Script getScriptById (String id)

This method is deprecated.
use getScriptById(String) instead
LL.getScriptById(id) -> getScriptById(id)

Retrieve a script by its unique identifier

Parameters
id identifier as given by Script#getId()
Returns
  • a script or null if no script with this id

public Script getScriptByName (String name)

This method is deprecated.
use getScriptByName(String) instead
LL.getScriptByName(name) -> getScriptByName(name)

Retrieve a script by name

Parameters
name as given by Script#getName()
Returns
  • a script or null if not found

public String getScriptTag ()

This method is deprecated.
use getTag() instead together with getCurrentScript()
LL.getScriptTag() -> getCurrentScript().getTag()

public VariableSet getVariables ()

This method is deprecated.
use getVariables() instead
LL.getVariables() -> getVariables()

Retrieve the whole set of known variables (builtins and user ones).

public void goToDesktop (int id)

This method is deprecated.
use goToDesktop(int) instead together with getHomeScreen()
LL.goToDesktop(id) -> getHomeScreen().goToDesktop(id)

Go to a specified desktop, without changing the current position in this desktop.

Parameters
id desktop identifier

public void goToDesktopPosition (int id, float x, float y)

This method is deprecated.
use goToDesktopPosition(int, float, float) instead together with getHomeScreen()
LL.goToDesktopPosition(id, x, y) -> getHomeScreen().goToDesktopPosition(id, x, y)

Go to a specified desktop and set the current absolute position in this desktop, setting a scale of 1 and using animations. This method does nothing when the script is run in background.

Parameters
id desktop identifier
x absolute X position, in pixel
y absolute Y position, in pixel

public void goToDesktopPosition (int id, float x, float y, float scale, boolean animate)

This method is deprecated.
use goToDesktopPosition(int, float, float, float, boolean) instead together with getHomeScreen()
LL.goToDesktopPosition(id, x, y, scale, animate) -> getHomeScreen().goToDesktopPosition(id, x, y, scale, animate)

Go to a specified desktop and set the current absolute position in this desktop. This method does nothing when the script is run in background.

Parameters
id desktop identifier
x absolute X position, in pixel
y absolute Y position, in pixel
scale zoom factor (1=100%, 0.5=50%, negative values are acceptable, 0 is not very useful)
animate whether to animate the move

public boolean isLocked ()

This method is deprecated.
use isLocked() instead
LL.isLocked() -> isLocked()

Returns true if the screen is currently locked using the Lightning lock screen.

public boolean isPaused ()

This method is deprecated.
use isPaused() instead together with getHomeScreen() (difference: this function returns false if any screen is not paused, not only the HomeScreen. For an exact substitute check all the other screens too)
LL.isPaused(tag) ~> getHomeScreen().isPaused()

Returns whether the current context is paused. It often means that Lightning Launcher is not displayed, for instance because another app is running. When the script is executed in the background this method always returns true.

public String loadRawResource (String pkg, String name)

This method is deprecated.
use loadRawResource(String, String) instead
LL.loadRawResources(pkg, name) -> loadRawResources(pkg, name)

This method is used to load a text from a package raw resource. Instances of use of this method are:

  • load scripts and set them as event handler (useful in script plugins)
  • load JSON data, such as theme colors, data, etc.

Parameters
pkg package name from which to read resources
name name of the raw resource. It must not contain the extension of the raw file, this is the Android identifier.
Returns
  • a string or null if the resource cannot be found or read

public int pickColor (String title, int color, boolean hasAlpha)

This method is deprecated.
use pickColor(String, int, boolean) instead together with an ActivityScreen
LL.pickColor(title, color, hasAlpha) -> 'pickColor' in getActiveScreen() ? getActiveScreen().pickColor(title, color, hasAlpha) : 0

Request the user to pick a color.

Parameters
title text displayed at the top of the dialog
color initial color to display
hasAlpha whether to display the transparency slider. It will not enforce a fully opaque color, it only acts on the slider visibility.
Returns
  • either the selected color, or undefined if the dialog has been canceled

public Image pickImage (int maxPixels)

This method is deprecated.
use pickImage(int) instead together with an ActivityScreen
LL.pickImage(maxPixels) -> 'pickImage' in getActiveScreen() ? getActiveScreen().pickImage(maxPixels) : null

Request the user to pick an image through the Lightning image picker screen. Warning: images returned by this function may be very large, take care at memory use as exceeding limits will make the launcher crash. Use the maxPixels parameter: the image will be scaled by a power of two so that its number of pixels is below or equal. This function supports picking bitmaps and nine patches.

Parameters
maxPixels maximum number of pixels in the returned image (width x height), 0 for no limit, 1048576 is one mega pixels (1024 x 1024)
Returns
  • an Image, or null if the user canceled the operation, or if the image cannot be loaded

public float pickNumericValue (String title, float value, String valueType, float min, float max, float interval, String unit)

This method is deprecated.
use pickNumericValue(String, float, String, float, float, float, String) instead together with an ActivityScreen
LL.pickNumericValue(title, value, valueType, min, max, interval, unit) -> 'pickNumericValue' in getActiveScreen() ? getActiveScreen().pickNumericValue(title, value, valueType, min, max, interval, unit) : 0

Request the user to enter a numeric value. When using the "%" unit, valueType must be set to FLOAT: the dialog will scale a decimal value so that 0.75 is displayed as 75%. Warning: the returned value may be subject to rounding errors.

Parameters
title text displayed at the top of the dialog
value initial value to display
valueType either INT or FLOAT. It will default to FLOAT if valueType is not a known value.
min minimum value for the slider
max maximum value for the slider
interval interval between values when sliding
unit text to display after the value (for instance "%" or "px"). When using "%" with FLOAT, scale value by 100
Returns
  • either the selected value, or undefined if the dialog has been canceled

public void runAction (int action, Item item, String data)

This method is deprecated.
use runAction(int, Item, String) instead together with a Screen
LL.runAction(action, item, data) -> getEvent().getScreen().runAction(action, item, data)

Run a Lightning action. This method does nothing when the script is run in background.

Parameters
action action code (one of the values defined in EventHandler
item item to be used as the target (only useful with actions requiring an item)
data optional data to send to be used by the action, use null if none

public void runAction (int action, String data)

This method is deprecated.
use runAction(int, String) instead together with a Screen
LL.runAction(action, data) -> getEvent().getScreen().runAction(action, data)

Same as #runAction(int,Item,String) with a null item and data.

public void runAction (int action)

This method is deprecated.
use runAction(int) instead together with a Screen
LL.runAction(action) -> getEvent().getScreen().runAction(action)

Same as #runAction(int,String) with a null data.

public void runScript (String name, String data)

This method is deprecated.
use runScript(String, String) instead together with a Screen
LL.runScript(name, data) -> getEvent().getScreen().runScript(name, data)

Run another script. Optional data can be transmitted to the called script and retrieved using getData().

Parameters
name name of the script as found in the script editor
data optional data to send to the script. Use JSON to pass more than a string.

public void save ()

This method is deprecated.
use save() instead
LL.save() -> save()

Persist launcher data now.

public boolean sendTaskerIntent (TaskerIntent intent, boolean synchronous)

This method is deprecated.
use sendTaskerIntent(TaskerIntent, boolean) instead
LL.sendTaskerIntent(intent, synchronous) -> sendTaskerIntent(intent, synchronous)

Send a tasker intent, optionally waiting for its completion to return.

Parameters
intent an intent built with TaskerIntent (see http://tasker.dinglisch.net/invoketasks.html for samples)
synchronous when true, Lightning will wait for Tasker task completion before to return, otherwise it will return immediately
Returns
  • when synchronous is true returns true if the intent has been sent successfully and Tasker reports a success too, when synchronous is false this method always returns true..

public void setScriptTag (String tag)

This method is deprecated.
use setTag(String) instead together with getCurrentScript()
LL.setScriptTag(tag) -> getCurrentScript().setTag(tag)

public void setVariableBoolean (String name, boolean value)

This method is deprecated.
use setVariableBoolean(String, boolean) instead
LL.setVariableBoolean(name, value) -> setVariableBoolean(name, value)

Set a boolean variable. This is a shortcut for LL.getVariables().edit().setBoolean(name, value).commit();. When modifying several at once, consider using the PropertyEditor object instead for best efficiency.

public void setVariableFloat (String name, float value)

This method is deprecated.
use setVariableFloat(String, float) instead
LL.setVariableFloat(name, value) -> setVariableFloat(name, value)

Set a boolean variable. This is a shortcut for LL.getVariables().edit().setFloat(name, value).commit();. When modifying several at once, consider using the PropertyEditor object instead for best efficiency.

public void setVariableInteger (String name, long value)

This method is deprecated.
use setVariableInteger(String, long) instead
LL.setVariableInteger(name, value) -> setVariableInteger(name, value)

Set a boolean variable. This is a shortcut for LL.getVariables().edit().setInteger(name, value).commit();. When modifying several at once, consider using the PropertyEditor object instead for best efficiency.

public void setVariableString (String name, String value)

This method is deprecated.
use setVariableString(String, String) instead
LL.setVariableString(name, value) -> setVariableString(name, value)

Set a string variable. This is a shortcut for LL.getVariables().edit().setString(name, value).commit();. When modifying several at once, consider using the PropertyEditor object instead for best efficiency.

public boolean startActivity (Intent intent)

This method is deprecated.
use startActivity(Intent) instead together with getActiveScreen()
LL.startActivity(intent) -> getActiveScreen().startActivity(intent)

Start an activity. Example:

 var intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.pierrox.net/")
 LL.startActivity(intent);

Parameters
intent intent to start the activity
Returns
  • true if launch is successful, false if activity not found or permission denied

public boolean startActivityForResult (Intent intent, Script receiver, String token)

This method is deprecated.
use startActivityForResult(Intent, Script, String) instead together with an ActivityScreen
LL.startActivityForResult(intent, receiver, token) -> 'startActivityForResult' in getActiveScreen() ? getActiveScreen().startActivityForResult(intent, receiver, token) : false

Start an activity and handle the result in another script. This is similar to http://developer.android.com/reference/android/app/Activity.html#onActivityResult%28int,%20int,%20android.content.Intent%29 This call is asynchronous and the script will continue its execution. Once the started activity ends, the "receiver" script is called with the following parameters set:

  • resultCode: Integer, the activity result, most often Activity.RESULT_OK or Activity.RESULT_CANCELED
  • data: Intent, data provided by the activity, if any
  • token: String, optional value passed as third argument in startActivityForResult
This method cannot be called when the executing script is run in the background. In that case it will do nothing and return false

Parameters
intent intent to start the activity
receiver a script to execute upon activity end
token an optional string data that you can transmit to the receiver script
Returns
  • true if the activity has been started

public void unlock ()

This method is deprecated.
use unlock() instead
LL.unlock() -> unlock()

Unlock the screen.

public void writeToLogFile (String data, boolean append)

This method is deprecated.
use writeToLogFile(String, boolean) instead
LL.writeToLogFile(data, append) -> writeToLogFile(data, append)

Write data to a file. This is for logging and debug purpose only. The path is not configurable and is: <external storage>/LightningLauncher/script/log.txt. Please note that this method won't add newlines automatically when appending data.

Parameters
data text to write to the file
append whether to clear the file before to write data, or append data to the existing content