aromeinit.attachapplicationcontext(context);
//initoptions配置示例,如不需特殊配置,可不传
bundle themeconfig = new bundle();
//横竖屏分屏配置示例,可按需配置
bundle portrait = new bundle();
portrait.putint("showtype", 2);
portrait.putint("launchwidth", 750);
themeconfig.putbundle("portrait", portrait);
bundle landscape = new bundle();
landscape.putint("showtype", 123);
landscape.putint("launchwidth", 375);
themeconfig.putbundle("landscape", landscape);
//freeform模式配置示例,可按需配置
themeconfig.putboolean("enablefloatwindow", true);
themeconfig.putintarray("windowbounds", rect);
themeconfig.putstringarraylist("floatwindowblacklist", blacklist);
//按参数构建initoptions
aromeinitoptions options = new aromeinitoptions.builder()
.deviceconfig(deviceconfig)
//全局主题参数配置,aromelaunchrequest中的themeconfig是局部配置,影响范围为这一次启动小程序
//局部配置优先级高于全局配置
.themeconfig(themeconfig)
.build();
//构建设备信息
aromeactivaterequest activaterequest = new aromeactivaterequest();
activaterequest.deviceid = "your_deviceid";
activaterequest.hostappid = "your_host_app_id";
activaterequest.productid = 123456;//your productid
activaterequest.signature = "your signature";
//initandactivate
aromeinit.initandactivate(options, activaterequest, new aromeinit.callback() {
@override
public void postinit(boolean success, int code, string msg) {