You can find here documentation relating to products, for more documentary resources, refer to the bibliography.

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**

How-to use the Widget Library

This library contains simple examples to understand how to use the main Widgets library APIs.
HOWTO for UI
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: SDK
Last updated:
29 August 2017
# Overview
This library contains simple examples to understand how to use the main Widgets library APIs. It is recommended to study them in the following order :

- [com.microej.howto.mwt.colors.Gradient](Widgets-Get-Started/src/main/java/com/microej/howto/mwt/colors/Gradient.java)

![Gradient](screenshots/Gradient.png)


# Usage
For each example:
## Run on MicroEJ Simulator
1. Right Click on the example to run `.java` file
2. Select **Run as -> MicroEJ Application**
3. Select your platform 
4. Press **Ok**


## Run on device
### Build
1. Right Click on the example to build `.java` file
2. Select **Run as -> Run Configuration** 
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 (but not a virtual device)
	2. In **Execution** frame
		1. Select **Execute on Device**
		2. In **Settings** field, select **Build & Deploy**
6. Press **Apply**
7. Press **Run**
8. Copy the generated `.out` file path
	
# Requirements
* MicroEJ Studio or SDK 4.0 or later
* A platform with at least:
	* EDC-1.2 or later
	* BON-1.2 or later
	* MICROUI-2.0 or later
	* MWT-2.1 or later

* Add the following line to your `module.ivy` or your `ivy.xml`:
> `<dependency org="ej.library.ui" name="widget" rev="2.0.0-alpha.10"/>`


# Dependencies
_All dependencies are retrieved transitively by Ivy resolver_.


# Source
N/A

# Restrictions
None.

How-to use the MicroUI Library

This library contains simple examples to understand how to use the main MicroUI library APIs.
HOWTO for UI
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: SDK
Last updated:
29 August 2017
<!--
	Markdown
	Copyright 2016 IS2T. All rights reserved.
	Use of this source code is governed by a BSD-style license that can be found at http://www.is2t.com/open-source-bsd-license/.
-->

# Overview
This library contains simple examples to understand how to use the main MicroUI library APIs. It is recommended to study them in the following order :


- [com.microej.howto.microui.drawing.Primitives](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/drawing/Primitives.java)

![Primitives](screenshots/Primitives.png)

- [com.microej.howto.microui.drawing.PrimitivesAntiAliased](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/drawing/PrimitivesAntiAliased.java)

![PrimitivesAntiAliased](screenshots/PrimitivesAntiAliased.png)

- [com.microej.howto.microui.font.Text](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/font/Text.java)

![Text](screenshots/Text.png)

- [com.microej.howto.microui.font.PictosWithCustomFont](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/font/PictosWithCustomFont.java)

![PictosWithCustomFont](screenshots/PictosWithCustomFont.png)

- [com.microej.howto.microui.image.TransparentImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/TransparentImages.java)

![TransparentImages](screenshots/TransparentImages.png)

- [com.microej.howto.microui.image.FlippedImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/FlippedImages.java)

![FlippedImages](screenshots/FlippedImages.png)

- [com.microej.howto.microui.image.RotatedImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/RotatedImages.java)

![RotatedImages](screenshots/RotatedImages.png)

- [com.microej.howto.microui.image.ScaledImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/ScaledImages.java)

![ScaledImages](screenshots/ScaledImages.png)

- [com.microej.howto.microui.image.TilingWithImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/TilingWithImages.java)

![TilingWithImages](screenshots/TilingWithImages.png)

- [com.microej.howto.microui.image.DeformedImages](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/image/DeformedImages.java)

![DeformedImages](screenshots/DeformedImages.png)

- [com.microej.howto.microui.events.InputEvents](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/events/InputEvents.java)

![InputEvents](screenshots/InputEvents.png)

- [com.microej.howto.microui.animation.AnimationSampleWithFullRepaint](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/animation/AnimationSampleWithFullRepaint.java)

- [com.microej.howto.microui.animation.AnimationSampleWithFlyingImage](/MicroUI-Get-Started/src/main/java/com/microej/howto/microui/animation/AnimationSampleWithFlyingImage.java)


Note that the same set of resources (images and fonts) is used across all of the examples.

# Usage
For each example:
## Run on MicroEJ Simulator
1. Right Click on the example to run `.java` file
2. Select **Run as -> MicroEJ Application**
3. Select your platform 
4. Press **Ok**


## Run on device
### Build
1. Right Click on the example to build `.java` file
2. Select **Run as -> Run Configuration** 
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 (but not a virtual device)
	2. In **Execution** frame
		1. Select **Execute on Device**
		2. In **Settings** field, select **Build & Deploy**
6. Press **Apply**
7. Press **Run**
8. Copy the generated `.out` file path
	
# Requirements
* MicroEJ Studio or SDK 4.0 or later
* A platform with at least:
	* EDC-1.2 or higher
	* BON-1.2 or higher
	* MICROUI-2.0 or higher

# Dependencies
_All dependencies are retrieved transitively by Ivy resolver_.

# Credits


| <p align="center">Font</p> | <p align="center">Author</p> | <p align="center">License</p> |
| --- | :---: | --- |
| Font Awesome | Dave Gandy <br/> http://fontawseome.io  | [SIL OFL 1.1 license - http://scripts.sil.org/OFL](/MicroUI-Get-Started/src/main/resources/fonts/OFL.txt)|
| Sans | Adobe |[SIL Open Font License.txt](/MicroUI-Get-Started/src/main/resources/fonts/Adobe-Source-SIL-Open-Font-License.txt)|


# Source
N/A

# Restrictions
None.

How-to use the Storage Library

This library contains simple examples to understand how to use the main Storage library APIs.
HOWTO for FILEDATA
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: Studio
Last updated:
29 August 2017
<!--
	Markdown
	Copyright 2016 IS2T. All rights reserved.
	Use of this source code is governed by a BSD-style license that can be found at http://www.is2t.com/open-source-bsd-license/.
-->

# Overview
MicroEJ firmware's disables access to the file system in application context. To store/retrieve information you should use a service provided by the firmware.
This service is called <code>Storage</code> and like any other services it can be retrieved by using the default `ServiceLoader` (if you want more information about Service, please read the firmware documentation).
> `Storage storage = ServiceLoaderFactory.getServiceLoader().getService(Storage.class);`

This service is based on key/value principle. The value is java's `InputStream` and the keys are java's `String` (with some restrictions on the allowed characters, see the javadoc). 

# Usage
## Store data
The `store` method needs an input stream and a key. During the method execution the given input stream is entirely read, closed and stored in the underlying file system (can be volatile or not depend on your firmware).

```java
String key = "MY_DATA"; //$NON-NLS-1$
try (ByteArrayInputStream bais = new ByteArrayInputStream("mydata".getBytes())) { //$NON-NLS-1$
   storage.store(key, bais);
} catch (IOException e) {
   e.printStackTrace();
}
```

## Retrieve data
Call the `load` method with the same key used to store the data, to retrieve it.

```java
try (InputStream stream = storage.load(key)) {
    // Do something with the input stream.
} catch (IOException e) {
    e.printStackTrace();
}
```

The application must close the input stream when it is no longer needed.

## List all stored data
An application can list all stored data by calling the <code>getIds</code> method. This method returns all data key's already stored.
```java		
try {
    for (String k : storage.getIds()) {
        System.out.println("Data available " + k);
    }
} catch (IOException e) {
    e.printStackTrace();
}
```

## Delete data
Call the `remove` method with the data key's to remove it.

```java
try {
    storage.remove(key);
} catch (IOException e) {
    e.printStackTrace();
}
```

## Run on MicroEJ Simulator
1. Right Click on the project
2. Select **Run as -> MicroEJ Application**
3. Select your virtual device. 
4. Press **Ok**

## Run on device
### Build
1. Right Click on the example
2. Select **Run as -> Run Configuration** 
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 virtual device.
	2. In **Execution** frame
		1. Select **Execute on Device**
		2. In **Settings** field, select **Local Deployment(...)**
6. In **Configurations** tab, set the options of the deployment
7. Press **Apply**
8. Press **Run**
	
# Requirements
* MicroEJ Studio or SDK 4.1 or later
* A virtual device

# Dependencies
_All dependencies are retrieved transitively by Ivy resolver_.

# Source
N/A

# Restrictions
None.

Device Developer's Guide

Learn to develop your first platform.
GUIDE for MISC
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: SDK
Last updated:
22 August 2017

MicroEJ SDK Errata

The Errata of MicroEJ SDK versions.
GUIDE for MISC
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: SDK
Last updated:
6 July 2017

Application Developer's Guide (Sandboxed)

Learn to develop your first sandboxed apps.
GUIDE for MISC
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: Studio
Last updated:
6 July 2017

Application Developer's Guide (Standalone)

Learn to develop your first standalone apps.
GUIDE for MISC
Supported MicroEJ Version: 4.1
Supported MicroEJ Edition: SDK
Last updated:
6 July 2017