Add new native formatter

Ashera provides predefined native formatter which has been discussed in the previous section here. Ashera provides framework to create predefined native formatter in cross platform way.

Installation

The following are the steps to create new native formatter:

  • Download a copy of https://github.com/AsheraCordova/Custom.git into the project folder. This project acts as a template for adding custom cross platform functionality.
  • Install the plugin onto the project using command cordova plugin add Custom.
  • Import the project into your favorite ide. e.g. eclipse
  • Sample native formatter can be found in the project here
  • After you create your new native formatter, you need to register it as follows MethodHandlerFactory.register(new CustomMethodHandler());
  • Also given that the project is cordova plugin, you need to update plugin.xml and reinstall the plugin for any new functionality to take effect.

Example - Points earned

The following example calculates point earned using the following formula points = quantity * (tradePrice - memberPrice);: