后台模式插件not_installed,甚至后台模式插件已经安装在ionic项目中



背景模式"plugin_not_installed";,甚至后台模式插件已经安装在离子项目中

错误在控制台中显示

{
[ng]   "error": "plugin_not_installed"
[ng] 

}

我的包.json详细介绍

//   "@ionic-native/background-mode": "^5.30.0",
//  "@angular/core": "^8.2.14",
// "@ionic-native/core": "5.0.0-beta.15",

注意:-platform.ready((是诀窍,将代码放入platform.ready((函数中

constructor(private platform: Platform,private backgroundMode: BackgroundMode){
platform.ready().then(() => {
console.log("background mode off")
this.backgroundMode.enable();
console.log("background mode check",this.backgroundMode.isActive(), this.backgroundMode.isEnabled(),this.backgroundMode.isScreenOff);

// this.backgroundMode.enable();

console.log("-------------------->", this.backgroundMode.isEnabled());
console.log("-------------------->", this.backgroundMode.isActive());

this.backgroundMode.on("activate").subscribe(()=>{

console.log("background mode on");

});
});
}

相关内容

  • 没有找到相关文章

最新更新