Automate Remote Launcher using Intents

From RemoteLauncher
Jump to: navigation, search

Please note that the format of the Intents used for Remote Launcher is subject to change.

As of version 0.2.1, Remote Launcher (and Remote Launcher Free) supports Android Intents. That means that it is possible to automate Remote Launcher using tools such as Tasker. It is also possible to invoke Remote Launcher from your own application.

Remote Launcher intents

If you want to call Remote Launcher from your own app, that is very easy. All you have to do is to call startActivity with a given Intent.

Please note that if using Remote Launcher Free then all references to com.owtroid.remotelauncher should be replaced with com.owtroid.remotelauncherfree except for where it says com.owtroid.remotelauncher.RemoteLauncher.

Launching a program

Create an Intent, set the component to Remote Launcher and then set the data to "start:launchername". Replace "launchername" with the desired launcher name (which needs to be correctly configured beforehand).

Remote Launcher will start, connect to the Remote Launcher server and try to start the application matching the given name.

Code example:

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.owtroid.remotelauncher", "com.owtroid.remotelauncher.RemoteLauncher"));
intent.setData(Uri.parse("start:Shutdown"));
startActivity(intent);

Changing the default server

Create an Intent, set the component to Remote Launcher and then set the data to "setserver:serverid". Replace "serverid" with the desired server id. The server id is an integer corresponding to the configured servers drop down list in the Remote Launcher settings. E.g. the first server in the list has id 0, the second has id 1 and so on.

Remote Launcher will start, change the default server and then exit.

Code example:

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.owtroid.remotelauncher", "com.owtroid.remotelauncher.RemoteLauncher"));
intent.setData(Uri.parse("setserver:1"));
startActivity(intent);

Sending a Wake On Lan package

Create an Intent, set the component to Remote Launcher and then set the data to "sendwol:serverid". Replace "serverid" with the desired server id. The server id is an integer corresponding to the configured servers drop down list in the Remote Launcher settings. E.g. the first server in the list has id 0, the second has id 1 and so on.

Remote Launcher will start and send a wol-package to the configured server. Note that the WOL-configuration has to have been entered in the server configuration prior to using this intent.

Code example:

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.owtroid.remotelauncher", "com.owtroid.remotelauncher.RemoteLauncher"));
intent.setData(Uri.parse("sendwol:0"));
startActivity(intent);

Tasker examples

NOTE: There is a known bug that prevents launchers from starting if the screen is off. To make sure your launchers are working even if the screen is not on you'll need to make sure that Tasker turns on the screen before starting Remote Launcher. To do so long press on the “Load App” entry where you are loading Remote Launcher inside of Tasker and then click on the little slider bar icon and check “Keep device awake”.

Tasker is a tool to automate tasks on your Android device. Using intents, it is possible to automate Remote Launcher with Tasker. You can use this for a number of use cases e.g. shutdown your home computer at a specific time or when you leave your home.

Launch a program at a specific time

Create a new profile in Tasker, select Time.

Add an action with category "app" and action "load app".

Select Remote Launcher or Remote Launcher Free and in the data field type "start:appname" without quotes.

Replace appname with the name of the launcher configured in Remote Launcher that you want to autostart. E.g. if you have a launcher called "Xbmc" then the string to put in the data field would be: start:Xbmc.

Now, at the given time, Tasker will start Remote Launcher which in turn will connect to the Remote Launcher Server and try to start the application matching the name set in the data field.