- // register new activity observer
- // {
- // id: "app id of target to observe",
- // type: "type of lifecycle, APP, HMI or GUI to observe",
- // filter: { states which observer wants to know }
- // }
- g_afb_instance->wmgr.amgr.api_register_activity_observer(req);
-
- afb_req_success(req, NULL, "success");
+ WMClientCtxt* wc_ctx = getWMClientContext(req);
+ if (wc_ctx == nullptr) {
+ afb_req_fail(req, "failed", "WMClientCtxt cannot create.");
+ } else {
+ // register new activity observer
+ // {
+ // id: "app id of target to observe",
+ // type: "type of lifecycle, APP, HMI or GUI to observe",
+ // filter: { states which observer wants to know }
+ // }
+ g_afb_instance->wmgr.amgr.api_register_activity_observer(req, wc_ctx->lcm_obs_ctx);
+ afb_req_success(req, NULL, "success");
+ }