我在一个有WebView加载一些Angular代码的项目中工作。我需要执行一种方法来发出网络请求,但是只有在收到两个值的情况下,它才会启动。
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onHybridAppLoaded(EventAppLoaded event){
Timber.d("Hybrid APP LOADED");
}
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onHybridAppViewLoaded(EventAppViewLoaded event){
Timber.d("Hybrid APP VIEW LOADED");
}
public void networkRequest(String type, String requestModel, String user, String token, String requestOK, String requestKO){
if(this.workingHost != null){
HybridApiController apiController = getHybridWebViews().getApiInstance(this.workingHost, "");
//TODO mapper request -> requestModel String
apiController.callRequest(user, token, new HybridRequest(), requestOK, requestKO);
}
}
我需要进行networkRequest等待,直到收到onHybridAppLoaded和onHybridAppViewLoaded。我该如何实现?