Convert a Standalone App into a Sandboxed App

This document explains how to convert a standalone app into a sandboxed app.
HOWTO for STORE
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: Studio
Last updated:
29 August 2017
# Overview
This document explains how to convert a standalone app into a sandboxed app.

# Usage
## CREATE THE APPLICATION
1. Use the wizard to create a new sandboxed app
	1. **File** â **New** â **MicroEJ Sandboxed Application Project**
	
## ADD THE DEPENDENCIES
1. Open the `module.ivy` file from the **standalone project**
2. Copy all the dependencies located in `<dependencies></dependencies>`
3. Open the `module.ivy` file from the **sandboxed project**
4. Paste the copied dependencies into `<dependencies></dependencies>`

## COPY THE SOURCES AND RESOURCES
1. From the **standalone project**, copy the content of `src/main/java`
2. Paste it into `src/main/java` in the **sandboxed project**.
3. From the **standalone project** copy the content of `src/main/resources`
4. Paste it into `src/main/resources` in the **sandboxed project**.

## LINK THE PROJECT TO A SANDBOXED APP ENTRY POINT
A sandboxed app needs a specific entry point which is not the main of the standalone app.

* If you have a GUI (i.e. using a GUI library such as MicroUI):
	1. Create a new class implementing `ej.wadapps.app.Activity`.
	2. On the **onStart()**, call your project's **main**.
* If you do not have any GUI:
	1. Create a new class implementing `ej.wadapps.app.BackgroundService`.
	2. On the **onStart()**, call your project's **main**.
	
## UPDATE THE META-INF
1. Move the **system.properties** except the services declarations to the **application.properties** file
	* In your code, replace the calls to `System.getProperty()` by calls to `ServiceLoaderFactory.getServiceLoader().getService(ApplicationsManager.class).getCurrentApplication().getProperty()`
2. For each local service declared
	* create a file with the fully qualified name of the service in the folder **services**
	* write one line containing the fully qualified name of the implementation class into this file
3. Update the `MANIFEST.MF` :
	* Set the **Application-Activities** to the created activities (if you have a GU).
	* Set the **Application-BackgroundServices** to the created background services (if you do not have a GUI).

## RUN ON MICROEJ SIMULATOR
1. Right Click on the project
2. Select **Run as -> MicroEJ Application**
3. Select **BackgroundServicesStandalone** or **ActivitiesStandalone**
4. Select your platform 
5. Press **Ok**

## RUN ON A DEVICE
### LOCAL DEPLOY
1. Right Click on /src/.generated~/.java/__YourProject__/generated/YourProjectEntryPoint.java
2. Select **Run as -> Run Configurations...** 
3. Select **MicroEJ Application** configuration kind
4. Click on **New launch configuration** icon
5. In **Execution** tab
	1. In **Target** frame, in **Platform** field, select a relevant platform
	2. In **Execution** frame
		1. Select **Execute on Device**
		2. In **Settings** field, select **Build & Deploy**
6. In **Configuration** tab
	1. In **Board** frame
		1. Set **Host** field to your board IP address
7. Press **Apply**
8. Press **Run**

Wadapps Framework

Multi-app development framework.
LIBRARY for STORE
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: Studio & SDK
Last updated:
6 July 2017
<!--
	Markdown
	Copyright 2015-2016 IS2T. All rights reserved.
	IS2T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->

# Overview
This library contains classes for multi-app development.

# Usage
Add the following line to your `module.ivy` or your `ivy.xml`:
> `<dependency org="ej.library.util" name="observable" rev="1.+"/>`
	
# Requirements
  - EDC 1.2 or later
  - KF 1.3 or later

# Dependencies
_All dependencies are retrieved transitively by Ivy resolver_.

# Source
N/A

# Restrictions
None.

KF (Foundation Library API)

The Kernel & Feature API.
LIBRARY for STORE
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: Studio & SDK
Last updated:
5 July 2017
<!--
	Markdown
	Copyright 2012-2016 IS2T. All rights reserved.
	IS2T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->

# Overview
This library contains classes and interfaces stubs of Kernel & Features API (ESR020).

# Usage
Add the following line to your `module.ivy` or your `ivy.xml`:
> `<dependency org="ej.api" name="kf" rev="1.+"/>`

# Requirements
  - EDC-1.2 or higher

# Dependencies
None.

# Source
N/A

# Restrictions
None.