So, should I really wait for the network available?

Some code first, this is from a small provider I created for data synchronization process,

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import { Subscription } from "rxjs/Rx";

import { Platform, AlertController } from "ionic-angular";

import { Network } from "@ionic-native/network";
import { Storage } from "@ionic/storage";

import { UnderDevelopment } from "../under-development";
import { ApiServicesProvider } from "../../providers/api-services/api-services";

import * as moment from "moment";

export class DataSyncProvider {

  connected: Subscription;
  disconnected: Subscription;

    public plfm: Platform, public net: Network,
    private undev: UnderDevelopment,
    private storage: Storage,
    private alertCtrl: AlertController,
    private api: ApiServicesProvider) {


  stop() {

  setup() { => {
      this.undev.addLater("What the heck...? " +;

    this.connected =
      .subscribe(result => {
          title: 'Available network',
          message: 'Synchronize offline data before continuing using.',
          buttons: [{
            text: 'Sync',
            handler: () => this.loadSchedules()

    this.disconnected =
      .subscribe(result => {
          title: 'Offine network',
          message: 'Consecutive data changes will be saved offline.',
          buttons: [{
            text: 'Acknowledge',
            handler: () => this.undev.addLater('Now storing data offline!')

  loadSchedules() {

    var today = moment().format("YYYY-MM-DD");

    this.undev.addLater(`Loading schedules today: ${today}`);

    // TODO: real request here
    //'db.synced', true);



As you can see, those two onConnect() and onDisconnect() work badly!
and I see lots of people struggle on this issue lately
(well, I didn’t add setTimeout(...) like the API document suggests, just because it makes me wait like forever)

But unexpectedly, that onchange() works great! It just gives right values at right time,
of course when network connection is truly available

so what you guys think?