Get Agate

Download Agate library, API Reference

Download the latest Agate Library for Android and iOS in a zip file and extract it on your computer.
This zip file contains the library files and the associated resource files.

Agate Library Package


MOML API Reference


Samples


MOML Application Viewer(Developer Tools)


MOML Application Viewer

The "MOML Application Viewer" is an application for browsing MOML(Mobile Object Markup Language) pages on the web or SD card.
You don't need to build android application for testing MOML pages if the page is in a web server.

Just run "MOML Application Viewer" and type page url. If you are not familiar or never heard about MOML, you can still look around by using default sample URLs. MOML Application Viewer automatically saves your recently entered URLs by latest order. It can be deleted by long press the URL list item. You can return to the first URL list page at anytime with "Quit" menu in option menu. (press device menu key)
The "Developer Console" menu in option menu is a very useful debugging tool.You can view logs or sources of current running MOML Pages.

MOML Application Viewer also provides "momlappviewer:" URI scheme. You can call MOML page on any other app or web browser. ex) momlappviewer:http://mospi.org/momlApps/MOMLAPI.


A Quick Code Overview

Here is an "Agate Hello World" demo:

First, make "applicationInfo.xml" file to configure basic information of MOML application. It could be loaded using MOMLView.loadApplication(1) as a Native function. APPLICATIONINFO/START.url must exist which assigns the initial display to be loaded.

applicationInfo.xml :

Second, make MOML UI XML file to design first page.

start.xml :

Test "Agate Hello World" demo with MOML Application Viewer
Click Here on mobile internet browser or type applusform.com/demo/hello in url field of MOML Application Viewer.

Setup Agate Android Library in Android Studio

1. Launch Android Studio, then create new android project. [File]-[New Project]

2. Import agate.aar as new module. [File]-[New Module]-[Import .JAR or .AAR Package]-[Next]
	- Choose agate.aar file from your Agate download earlier.

3. Add module dependency
	- Open [MyProjectName]/app/build.gradle file.
	- Add compile project(':agate') line in dependencies block. (or use [File]-[Project Structure] menu)

4. Add following permission lines to AndroidManifest.xml
	<uses-permission android:name="android.permission.INTERNET" /> 
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

5. Make a few adjustments to the project's MainActivity.Java file found in the src/java folder :
	- Add import org.mospi.moml.framework.pub.core.MOMLFragmentActivity;
	- Change the class's extend from Activity to MOMLFragmentActivity
	- Add loadApplication("moml/applicationInfo.xml"); line in onCreate() function.

6. Make [MyProjectName]/app/src/main/assets folder for user resources.

This is a folder structure example of an Agate Android Studio project.

MyProjectName
┠ .idea
┠ agate
┃ ┠ agate.aar
┃ ┗ ...
┠ app
┃ ┠ libs
┃ ┠ src
┃ ┃ ┗ main
┃ ┃    ┠ assets
┃ ┃    ┃ ┗ moml
┃ ┃    ┃    ┠ applicationInfo.xml
┃ ┃    ┃    ┗ [user xml files, images, ...]
┃ ┃    ┠ java
┃ ┃    ┃ ┗ com.package.name
┃ ┃    ┃    ┗ MainActivity.java
┃ ┃    ┠ res
┃ ┃    ┗ AndroidManifest.xml
┃ ┠ build.gradle
┃ ┗ ...
┠ build
┗ ...

			

Remarks
Since MOML is supported beginning from Android 2.3.3, the Minimum Required SDK when generating Android project is later version than Android 2.3.3 (Gingerbread).


Setup Agate iOS Library in Xcode

1. Launch Xcode, then create new android project [File]-[New]-[Project]-[iOS Application]

2. Copy Agate.framework, Agate.bundle folder from your Agate download earlier to the root folder of the project

3. Add Agate.framework, Agate.bundle folder to Project
	- [Click "MyProjectName" on Project Navigator]
	- select menu [File]-[Add Files to "MyProjectName"]
		or click right mouse button -[Add Files to "MyProjectName"]
	- select Agate.framework, Agate.bundle folder (use "Command Key" to select multiple items)
	- click [Add] button

3. Add following frameworks and libraries 
	- Click "MyProjectName" on Project Navigator
	-[TARGETS]-[Build Phases tab]-[Link Binary With Libraries]-[+]
	- Select following items (use "Command Key" to select multiple items)
		AddressBook.framework
		AssetsLibrary.framework
		AudioToolbox.framework
		AVFoundation.framework
		CFNetwork.framework (*)
		CoreGraphics.framework (*)
		CoreLocation.framework
		CoreMotion.framework
		CoreText.framework
		Foundation.framework (*)
		libsqlite3.dylib
		libstdc++.6.dylib
		libxml2.dylib
		MapKit.framework
		MediaPlayer.framework
		MessageUI.framework
		MobileCoreServices.framework
		OpenGLES.framework (*)
		QuartsCore.framework (*)
		Security.framework
		SystemConfiguration.framework
		UIKit.framework (*)
	- click [Add] button

4. Add -all_load linker flag.
	- Click "MyProjectName" on Project Navigator
	- [TARGETS]-[Build Settings tab]-[Linking section]-[Other Linker Flags]
	- Add -all_load option.
	
5. Modify ViewController
	* Swift
		- Open "ViewController.swift" file
		- Add import Agate line
		- Change ViewController's super class from UIViewController to MOMLUIViewController
		- Add loadApplication("moml/applicationInfo.xml") line in viewDidLoad() function

	* Objective-C
		- Open "ViewerController.h" file
		- Add #import <Agate/Agate.h> line
		- Change ViewController's super class from UIViewController to MOMLUIViewController
		- Open "ViewerController.m" file
		- Add [self loadApplication:@"moml/applicationInfo.xml"]; line in viewDidLoad function

This is a folder structure example of an Agate iOS project.

MyProjectName
┠ moml
┃ ┠ applicationInfo.xml
┃ ┗ [user xml files, images, ...]
┠ MyProjectName (Swift)
┃ ┠ AppDelegate.swift
┃ ┠ Info.plist
┃ ┠ ViewController.swift
┃ ┗ ...
┠ MyProjectName (Objective-C)
┃ ┠ AppDelegate.h
┃ ┠ AppDelegate.m
┃ ┠ Info.plist
┃ ┠ main.m
┃ ┠ ViewController.h
┃ ┠ ViewController.m
┃ ┗ ...
┠ MyProjectName.xcodeproj
┠ Agate.bundle
┃ ┗ org_mospi_moml_framework
┠ Agate.framework
┃ ┠ Headers
┃ ┗ ...
┗ ...

			

Setup Agate Android Library in Eclipse (deprecated)

1. Launch Eclipse, then create new android project [File]-[New]-[Android Project]

2. Copy libs, assets, res folder from your Agate download earlier to the root folder of the project

3. Add following permission lines to AndroidManifest.xml
	<uses-permission android:name="android.permission.INTERNET" /> 
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

4. Make a few adjustments to the project's main Java file found in the src folder in Eclipse:
	- Add import org.mospi.moml.framework.pub.core.MOMLActivity;
	- Change the class's extend from Activity to MOMLActivity
	- Add MOMLWebKit.init(getMomlView()); line in onCreate() function
	- Add loadApplication("moml/applicationInfo.xml"); line in onCreate() function

You might experience an error here, where Eclipse can't find MOMLLibrary.jar. In this case, right click on the /libs folder and go to Build Paths/ > Configure Build Paths. Then, in the Libraries tab, add MOMLLibrary.jar to the Project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.

This is a folder structure example of an Agate Android Eclipse project.

MyProjectName
┠ src
┠ gen
┠ assets                            
┃ ┠ moml
┃ ┃ ┠ applicationInfo.xml
┃ ┃ ┗ [user xml files, images, ...]
┃ ┗ org_mospi_moml_framework
┃    ┗ [moml default resources]
┠ bin
┠ libs                              
┃ ┠ MOMLAgate.jar
┃ ┗ armeabi                        
┃    ┠ libjni-moml.so
┃    ┠ libjni-moml-gl.so
┃    ┗ libjni-moml-libxml.so
┠ res
┃ ┠ drawable-hdpi
┃ ┠ drawable-mdpi
┃ ┠ layout
┃ ┗ values
┃    ┗ org_mospi_moml_framework_strings.xml
┠ AndroidManifest.xml
┗ ...

			

Remarks
Since MOML is supported beginning from Android 2.3.3, the Minimum Required SDK when generating Android project is later version than Android 2.3.3 (Gingerbread).