百度harmony next 定位sdk提供后台持续定位的能力,可在应用退至后台的状态下,持续记录位置信息。具体使用方法如下:
letwantagentinfo: wantagent.wantagentinfo={wants:[{bundlename:"bundlename",abilityname:"abilityname"}],operationtype: wantagent.operationtype.start_ability,requestcode:0,wantagentflags:[wantagent.wantagentflags.update_present_flag]};wantagent.getwantagent(wantagentinfo).then((wantagentobj:wantagent)=>{if(locclient !=null){locclient.enablelocinbackground(wantagentobj);}});
if(this.client!=null){this.client.disablelocinbackground();}
“abilities”:[..."backgroundmodes":[// 长时任务类型的配置项"location"]]并申请长时任务权限
上一篇
下一篇
本篇文章对您是否有帮助?