Android平台集成ArkUI-X接口类
实现OpenHarmony平台与Android平台的对接,可以帮助开发者将基于ArkUI开发的应用运行在标准的Android设备上。
BridgePlugin (平台桥接)
本模块提供ArkUI端和Android平台端消息通信的功能,包括数据传输、方法调用和事件调用。需配套ArkUI端API使用
StageApplication
Stage模型Application,用于初始化资源路径以及加载配置信息
StageApplication是Application的子类,是Stage模型Android应用的入口。ArkUI-X Stage模型Android平台应用开发时,需要继承StageApplication。
StageApplicationDelegate
Stage模型Application代理类,将来自StageApplication的数据经过处理后传递给OpenHarmony框架层
java.lang.Object
└── StageApplicationDelegate
public class StageApplicationDelegate
StageApplicationDelegate是ArkUI-X跨平台上Stage模型Application的代理类,是启动跨平台应用的入口。跨平台的应用必须在其Application的onCreate里创建StageApplicationDelegate,并调用其初始化方法,完成js runtime创建、JsBundle资源解析等工作。
方法概要
类型 | 方法 | 描述 |
---|---|---|
void | init(Application application) | 初始化 |
void | onConfigurationChanged(Configuration newCfg) | 系统环境变化通知 |
方法说明
- init
/**
* init js environment, should called in application onCreate()
*
* @param application the target application
*/
public void init(Application application);
- onConfigurationChanged
/**
* Called by the system when the device configuration changes while your component is running.
*
* @param newConfig current configuration of environment.
*/
public void onConfigurationChanged(Configuration newConfig);
StageActivity
Stage模型Activity,将Android中Activity的生命周期与OpenHarmony中Ability的生命周期进行映射
java.lang.Object
└── android.content.Context
└── android.content.ContextWrapper
└── android.view.ContextThemeWrapper
└── android.app.Activity
└── ohos.ace.adapter.StageActivity
public class StageActivity
extends Activity
StageActivity是Activity的子类,是Android Activity组件生命周期入口。ArkUI-X Android平台应用开发Stage模型的Ability时,必须继承StageActivity,并在子类中设置JsBundle实例名。
方法概要
类型 | 方法 | 描述 |
---|---|---|
void | setInstanceName(String name) | 设置ArkUI JSBundle实例名 |
方法说明
- setInstanceName
/**
* set the instance name, should called before super.onCreate()
*
* @param name the instance name to set
*/
public void setInstanceName(String name);