Closed bangonkali closed 4 years ago
BTW, here is the workaround to get the context in Android.
public static JSContext getJSContextFromMicroService(MicroService service) {
final JSContext[] context_ = new JSContext[1];
final Semaphore sync_ = new Semaphore(0);
Process.EventListener listener = new Process.EventListener() {
@Override public void onProcessStart(Process process, JSContext ctx) {
context_[0] = ctx;
sync_.release();
}
@Override public void onProcessAboutToExit(Process process, int exitCode) {}
@Override public void onProcessExit(Process process, int exitCode) {}
@Override public void onProcessFailed(Process process, Exception error) {}
});
service.getProcess().addEventListener(listener);
sync_.acquireUninterruptibly();
service.getProcess().removeEventListener(listener);
return context_[0];
}
This feature has been added to 0.7.5
Thanks @ericwlange Looking forward to update on my end.
Hi @ericwlange, in relation to https://github.com/LiquidPlayer/LiquidCore/issues/138#issuecomment-558262820, it's totally up to you if it's safe to expose
service.getProcess().getContext()
and in what manner to expose the context. But it would really be handy if there was a standard way for this to be exposed especially that I could not get it frompayload.getContext()
https://github.com/LiquidPlayer/LiquidCore/issues/141.