Ionic framework 离子3背景模式返回为假
我使用Ionic 3,我希望我的应用程序也能在后台工作,现在我尝试在app.component中使用Ionic 3的后台模式,使用这个.backgroundMode.enable(),然后使用方法isEnable(),但当我使用isEnable()时,它返回为false。我做错了什么,为什么它返回为假?请帮帮我Ionic framework 离子3背景模式返回为假,ionic-framework,Ionic Framework,我使用Ionic 3,我希望我的应用程序也能在后台工作,现在我尝试在app.component中使用Ionic 3的后台模式,使用这个.backgroundMode.enable(),然后使用方法isEnable(),但当我使用isEnable()时,它返回为false。我做错了什么,为什么它返回为假?请帮帮我 import { BackgroundMode } from '@ionic-native/background-mode'; import { Component } from '@a
import { BackgroundMode } from '@ionic-native/background-mode';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage: any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private backgroundMode: BackgroundMode) {
platform.ready().then(() => {
this.backgroundMode.enable()
var bgmStatus = this.backgroundMode.isEnabled();
console.log(bgmStatus);
statusBar.styleDefault();
splashScreen.hide();
});
}
}
import { BackgroundMode } from '@ionic-native/background-mode';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage: any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private backgroundMode: BackgroundMode) {
platform.ready().then(() => {
this.backgroundMode.enable()
var bgmStatus = this.backgroundMode.isEnabled();
console.log(bgmStatus);
statusBar.styleDefault();
splashScreen.hide();
});
}
}