Я отправил этот вопрос 2 дня назад, но я не получил никакого ответа.Я хочу получать местное уведомление каждый день в 10:00.мой код: а также иногда я получаю уведомления, тогда он не может быть удален путем обмена на панели уведомлений.
Пожалуйста, проверьте мой код и дайте мне как можно скорее ответ
import { Component } from '@angular/core';
import { Platform, NavController, ToastController, AlertController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
import { MainpagePage } from "../pages/mainpage/mainpage";
import { LoginPage } from "../pages/login/login";
import { SplashPage } from "../pages/splash/splash";
import { Observable } from 'rxjs/Rx';
import { Geolocation } from '@ionic-native/geolocation';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
import { DbHandlerProvider } from '../providers/db-handler/db-handler';
import { LocationTracker } from '../providers/location-tracker/location-tracker';
import { BackgroundMode } from '@ionic-native/background-mode';
import { HttpService } from '../pages/services/httpService';
import { LocalNotifications } from '@ionic-native/local-notifications';
import moment from 'moment';
import { Diagnostic } from '@ionic-native/diagnostic';
declare let cordova: any;
import { LocationAccuracy } from '@ionic-native/location-accuracy';
import { Subscription } from 'rxjs';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any;
db: SQLiteObject;
time: any;
arrTime: any = [];
arrNotification: any = [];
onResumeSubscription: Subscription;
constructor(public platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,private geolocation: Geolocation,
private sqlite: SQLite, private dbHandlerProvider: DbHandlerProvider,
public locationTracker: LocationTracker,private backgroundMode: BackgroundMode,
public httpService: HttpService, public toastCtrl: ToastController,private localNotifications: LocalNotifications,
private diagnostic: Diagnostic, private alertCtrl: AlertController, private locationAccuracy: LocationAccuracy) {
this.dbHandlerProvider.createDatabase();
this.backgroundMode.enable();
if(localStorage.getItem('UserId') == null){
this.rootPage = LoginPage;
} else {
this.rootPage = MainpagePage;
}
platform.ready().then(() => {
setTimeout(()=>{
this.pushNotification();
},1000);
statusBar.styleDefault();
});
}
pushNotification() {
var pushTime = moment().add(0, 'days').hours(10).minutes(0).seconds(0);
let data = {
text: 'Aaron Harper Notification ',
every: 'day',
firstAt: pushTime.toDate()
}
cordova.plugins.notification.local.schedule(data);
}
}
заранее спасибо ...