Introduction

Many different kinds of people use Ashera Native: from advanced developers to beginners, to people getting started programming for the first time in their career. These docs were written for all learners, no matter their experience level or background.

How to use these docs

You can start here and read through these docs linearly like a book; or you can read the specific sections you need. Already familiar with Ashera? You can skip that section—or read it for a light refresher.

Prerequisites

To work with Ashera Native, you will need to have an understanding of Apache Cordova, Java, TypeScript and Android fundamentals. If you’re new to above technologies or need a refresher, you can check the following links:
Apache Cordova
Typescript
Java Tutorial
Android

Interactive examples

This introduction lets you get started immediately in your browser with interactive examples like this one:

Why Ashera was created?

Ashera was created with the following goals:

Reusability using Code poaching

Don't reinvent the wheel. Ashera uses android as it base for creating layouts. Layouting code on android is factored out using a technique known as "code poaching" where reusable code is extracted out from the android java file using java parser and rest of the code is stubbed and ensured that the code does not fail. This technique is powerful as Ashera supports the advanced layouts supported by Android such as Recycler View, Constraint Layout on other platforms such as IOS, Browser and SWT.

Design Time Preview

Most of the cross platform framework provides live preview on device. However design time preview is thought to require lot of development effort where an IDE has to be developed. By simulating Android for other platform, Android studio can be used for ui development and no extra effort is required for design preview of xml design files.

Dynamic UI

One of classic examples of creating dynamic UI is that of CMS, the user can create ui on the fly with a few drag and drop and the UI should be downloadable onto the device. Ashera is bundled with tagsoup parser and Javacc css parser. Android xml created using studio can be downloaded using http and executed on device to get an native interface.

Widget Overiding and Mixing

Ashera uses native widgets for rendering. One of problems of using native widgets is that you are tied to the short coming of the widgets provided by the underlying framework. Let us take an example of EditText in android. It provides single line and multiline capability. However in IOS, we have UITextField and UITextView where UITextField provides single line capability and UITextView provides multiline capability. To solve this problem, Ashera supports widget overiding and mixing so that you can choose what widget you want at runtime.

Simulation vs Emulation

Ashera simulates android platform on other platforms and tries to only reuse the layouting mechanism of android on other platforms. One of the drawbacks of this method is that, the widgets might have unimplemented attributes. However, a score is given to each widget simulated which refers to the degree to which it closely simulates an Android widget.

Extensible

Ashera is designed to be extensible in all direction. Idea is to add new attributes, replace widgets, register new widgets, create new validators through a extensible registration framework.

Plugin framework

Plugin based frameworks are usually successful. Ashera uses cordova which already provides the plugin backbone code required to create additional functionality required by the usecases.

IDE Reusability

Ashera recommends using Android Studio by Google and Visual Studio code by Microsoft for development. It's main aim was to reuse the IDE features provided by existing providers rather than creating a new IDE from scratch.

Data Binding & Validations

Ashera provides a framework for storing and retrieving model on the native side. It is recommended to store data on the native side and keep webview stateless and use it as an http client. The main idea here was that usually network call takes time in order of 1-2 seconds. The time required for the request to pass from native to the webview will be negligible when compared to he network call. In such cases, it is perfectly fine to use webview for handling ui events.

WebView UI Events vs Native events

Ashera provides a framework where ui events from native reaches the webview and javascript framework handles the same. In some cases, it might not be possible to handle the event on the webview side as the ui performance delivered might be poor. Ashera provides a mechanism where you can write event handler code using java and deliver native performance by eliminating the webview call.

Native formatters

An usual scenario which we encounter, model on the native side needs to be displayed on ui with some kind of formatting applied to the attribute of the model. Ashera provides a formatting framework, where the model can be tranformed on the native side without an additional trip to the webview thereby exibiting native performance.

Formatting

Menu paths are written in bold and use carets to navigate submenus. Example: Android Studio > Preferences