有的第三方sdk需要在Application中进行初始化,但是uts插件目前不知道怎么实现这种功能
public class LocationApplication implements UniAppHookProxy {
@Override
public void onCreate(Application application) {
//可写初始化触发逻辑
Context context = application;
// 确保只有主进程进行SDK初始化
if (context.getPackageName().equals(DeviceUtil.getCurrentProcessName(context))) {
MDPLocationCollectionManager.initialize(context, "https://oapi.alct56.com");
MDPLocationCollectionManager.initServiceProcessProguard(context);
context.startService(new Intent(context, PlayerMusicService.class));
}
}
@Override
public void onSubProcessCreate(Application application) {
//子进程初始化回调
}
}