Android native interface

This is the explanation of the main items among the native Android interfaces supported by the Nexacro Platform library. Depending on the time of operation, it can be divided into an interface used upon startting and an interface used while the app is running.

Time of use

Android native interface

When starting the app

com.nexacro.NexacroUpdatorActivity

com.nexacro.NexacroResourceManager

When using the app

com.nexacro.NexacroActivity

com.nexacro.NexacroEventHandler

com.nexacro.NexacroUpdatorActivity

setBootstrapURL

setBootstrapURL(url)

parameter

Description

url

URL string of the path where the start_android.json file is placed (including the file name)

Specify the server URL string value where the bootstrap file (start_android.json) is placed. The bootstrap file contains the information needed to run the project. The corresponding information is delivered when nexacroActivity is run.

setProjectURL

setProjectURL(url)

parameter

Description

url

URL string of the path where the created source files are placed

A '/' must be appended to the end of the URL string to indicate the path. The corresponding information is delivered when nexacroActivity is run.

setStartupClass

setStartupClass(startupClass)

parameter

Description

startupClass

Activity to run after the update is completed

The default value is nexacroActivity. The method is not called if the default value is used.

com.nexacro.NexacroResourceManager

setDirect

setDirect(updatetype)

parameter

Description

updatetype

Specify the Update Type option as the boolean value

true: "Server"

false: "Update(Local+Server)" or "Local"

Set the value according to the Update Type set when executing the Nexacro Studio menu [Deploy > Packing(Archive&Update)]. Set up as follows in onCreate of NexacroUpdaterActivity.

protected void onCreate(Bundle savedInstanceState) {
	NexacroResourceManager.createInstance(this);
	NexacroResourceManager.getInstance().setDirect(false);

setScreenid

setScreenid(screenid)

parameter

Description

screenid

Screen ID to apply as layout

Screen ID is automatically selected according to the operating system, size, and type of the device. This method is used when specifying a specific Screen ID. Set up in onCreate of NexacroUpdaterActivity.

setContentMode

setContentMode(mode)

parameter

Description

mode

Setting the content mode

Operates in content mode when set to true

Set whether to operate in content mode or not. Set the value to true to use the setFDL method.

setFDL

setFDL(fdlURL)

parameter

Description

fdlURL

form URL settings

"FrameBase::Specify the Services path of TypeDefinition in the same method as "FrameBase::Form_Work.xfdl"

Set the form URL to be executed.

setKeyName

setKeyName(keyName)

parameter

Description

keyName

Set environment key properties

com.nexacro.NexacroActivity

callScript

callScript(method)

parameter

Description

method

Specify the

method of the Application object included in the JavaScript Nexacro Platform

library as a string.

The string delivered as an argument is processed and executed by the eval function in JavaScript. When the callScript method is executed, it is converted into the following format in JavaScript.

NexacroActivity.getInstance().callScript("fn_test('Hello nexacro!')"); // Java
eval("nexacro.getAppication().fn_test('Hello nexacro!');"); // JavaScript

createNexacroApplication

createNexacroApplication([key])

parameter

Description

key

Set the name (key) when creating NexacroApplication.

If the value is not set, the internal library will randomly assign one.

getNexacroApplication

getNexacroApplication()

Returns the Application owned by NexacroActivity.

com.nexacro.NexacroEventHandler

onUserNotify

onUserNotify(int nNotifyID, String strMessage)

method

Description

nNotifyID

ID value delivered from userNotify method of Nexacro Platform

strMessage

String to be processed

The callScript method delivers values from Android to the Nexacro Platform script, and the onUserNotify delivers the values from the Nexacro Platform script to Android. When the Nexacro Platform userNotify method is executed, Android receives and processes the value in the following format.

nexacro.getEnvironment().userNofity(100, "HelloWorld"); // JavaScript
public class UserNotify implements NexacroEventHandler {
	public UserNotify() {
		if(NexacroActivity.getInstance() != null)
			NexacroActivity.getInstance().setNexacroEventListener(this);
	}
	
	@Override
	public void onUserNotify(int nNotifyID, String strMessage) {
		Log.d("UserNotify", "onUserNotify nNotifyID : " + nNotifyID + " strMessage : " + strMessage);
	}
} // Java