Package org.robovm.libimobiledevice.util
Class AppLauncher
java.lang.Object
org.robovm.libimobiledevice.util.AppLauncher
public class AppLauncher
extends java.lang.Object
Launches an application on a device using the
com.apple.debuserver
service. The app must have the get-task-allow entitlement set to
true in order to be allowed to be launched by the debug server.-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_FORWARD_PORT -
Constructor Summary
Constructors Constructor Description AppLauncher(IDevice device, java.io.File localAppPath)Creates a newAppLauncherwhich will install the app from the specified IPA file or app bundle dir and launch it.AppLauncher(IDevice device, java.lang.String appId)Creates a newAppLauncherwhich will launch an already installed app with the specified id. -
Method Summary
Modifier and Type Method Description AppLauncherappLauncherCallback(AppLauncherCallback callback)Sets a callback that is invoked when the remote app info is known.AppLauncherargs(java.lang.String... args)Adds command line arguments which will be passed to the app on launch.AppLaunchercloseOutOnExit(boolean closeOutOnExit)Sets whether the stdout stream should be closed once the app has terminated.AppLauncherdebug(boolean debug)Sets whether GDB protocol packets should be logged toSystem.out.AppLauncherenv(java.lang.String name, java.lang.String value)Adds an environment variable which will be set when launching the app.AppLauncherenv(java.util.Map<java.lang.String,java.lang.String> env)Adds environment variables which will be set when launching the app.AppLauncherforward(int localPort)Forwards all GDB communication to the local TCP port after the app has been successfully launched.voidinstall()AppLauncherinstallStatusCallback(InstallationProxyClient.StatusCallback callback)Sets anInstallationProxyClient.StatusCallbackwhich will be used to report the progress when the app is installed on the device.voidkill()intlaunch()AppLauncherlaunchOnLockedRetries(int launchOnLockedRetries)Sets the number of times to retry a launch if the device is locked.protected voidlog(java.lang.String s, java.lang.Object... args)Logs a message toSystem.out.static voidmain(java.lang.String[] args)AppLaunchersecondsBetweenLaunchOnLockedRetries(int secondsBetweenLaunchOnLockedRetries)Sets the number of seconds to wait between launch retries when the device is locked.AppLauncherstdout(java.io.OutputStream stdout)Sets anOutputStreamwhich all console output (stdout and stderr) of the app will be written to when the app is launched.AppLauncheruploadProgressCallback(AfcClient.UploadProgressCallback callback)Sets anAfcClient.UploadProgressCallbackwhich will be used to report the progress when the app is uploaded to the device.AppLauncherxcodePath(java.lang.String xcodePath)Sets the path to Xcode where developer images will be searched for.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
DEFAULT_FORWARD_PORT
public static final int DEFAULT_FORWARD_PORT- See Also:
- Constant Field Values
-
-
Constructor Details
-
AppLauncher
Creates a newAppLauncherwhich will launch an already installed app with the specified id.- Parameters:
device- the device to connect to.appId- the id (CFBundleIdentifier) of the app to run.
-
AppLauncher
Creates a newAppLauncherwhich will install the app from the specified IPA file or app bundle dir and launch it.- Parameters:
device- the device to connect to.localAppPath- the IPA file of app bundle dir containing the app to install and launch.- Throws:
java.io.IOException
-
-
Method Details
-
uploadProgressCallback
Sets anAfcClient.UploadProgressCallbackwhich will be used to report the progress when the app is uploaded to the device.- Parameters:
callback- the callback.
-
installStatusCallback
Sets anInstallationProxyClient.StatusCallbackwhich will be used to report the progress when the app is installed on the device.- Parameters:
callback- the callback.
-
args
Adds command line arguments which will be passed to the app on launch.- Parameters:
args- the arguments to be added.
-
stdout
Sets anOutputStreamwhich all console output (stdout and stderr) of the app will be written to when the app is launched. By default all output will be written toSystem.out- Parameters:
stdout- theOutputStream.
-
closeOutOnExit
Sets whether the stdout stream should be closed once the app has terminated.- Parameters:
closeOutOnExit-trueorfalse.
-
env
Adds an environment variable which will be set when launching the app.- Parameters:
name- the variable name.value- the variable value.
-
env
Adds environment variables which will be set when launching the app.- Parameters:
env- the variables.
-
debug
Sets whether GDB protocol packets should be logged toSystem.out. Disabled by default.- Parameters:
debug-trueto enabled debug logging.
-
forward
Forwards all GDB communication to the local TCP port after the app has been successfully launched.- Parameters:
localPort- local port or -1 to disable
-
appLauncherCallback
Sets a callback that is invoked when the remote app info is known. -
xcodePath
Sets the path to Xcode where developer images will be searched for. This should be set to the value returned byxcode-select. If not set/Applications/Xcode.app/Contents/Developerwill be used.- Parameters:
xcodePath- the Xcode path.
-
launchOnLockedRetries
Sets the number of times to retry a launch if the device is locked. Default is 5. -
secondsBetweenLaunchOnLockedRetries
Sets the number of seconds to wait between launch retries when the device is locked. The default is 5. -
kill
public void kill() -
log
protected void log(java.lang.String s, java.lang.Object... args)Logs a message toSystem.out. Override this method to use a custom logger. -
install
public void install() throws java.io.IOException- Throws:
java.io.IOException
-
launch
public int launch() throws java.io.IOException- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-