【发布时间】:2019-06-22 09:11:15
【问题描述】:
我通过这些命令安装了cordova后台模式插件
离子cordova插件添加cordova-plugin-background-mode
npm install @ionic-native/background-mode
在 app.module.ts 中我是这样导入的
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
并添加到提供者数组中。
我的 page.component.ts
constructor(private pltfm: Platform, private backgroundMode: BackgroundMode) { }
ngOnInit() {
this.pltfm.ready().then(() => {
this.backgroundMode.on('activate').subscribe(() => {
console.log('activated');
});
this.backgroundMode.enable();
});
}
我在运行应用程序时收到 backgroundMode Plugin not installed 错误。我该如何解决这个问题?
Native: tried calling BackgroundMode.enable, but the BackgroundMode plugin is not installed.
【问题讨论】:
标签: cordova cordova-plugins ionic4 ionic-native