title: How to get sleep data in my ionic app from google fit/android as sleep?
body: <p>I am new to ionic framework, So the other day I tried to get data from google fit and I am able to get steps and calories but I am not able to get sleep data,So my question is is there any way I can get sleep data in my ionic app(either from google fit or any other android application).
  I already checked <a href="https://github.com/dariosalvi78/cordova-plugin-health" rel="nofollow noreferrer">this ionic Cordova site</a></p>
  
  <p>Here is the code to get walking data but don't know about sleep</p>
  
  <pre><code>    loadWalking(){
      console.log("####*******  Load Health data entered");
  var fromDate = new Date(new Date().getTime() - days * 24 * 60 * 60 * 1000);
  var toDate = new Date();
  if (days &gt; 0) {
    console.log("#### Load health calling for " + days + " days");
    this.health.query({
      startDate: fromDate, //  days ago
      endDate: toDate, // now
      dataType: 'steps'
    }).then(res =&gt; {
      // var data = res;
      // if(res.length&gt;0)
      // alert("Load Health Data"+JSON.stringify(res));
  
      console.log("Walking data from API"+JSON.stringify(res));
  
  
  
      this.storage.get('my-json').then((val) =&gt; {
        this.calculateTodayStep(res);
  
  
        if(val==null || JSON.stringify(val) != JSON.stringify(res)){
          console.log("not equal");
          this.storage.set('my-json', res);
          this.saveToDB(res);
          console.log("*************6.load HEALTH DATA RESULT:::" + JSON.stringify(res)); //this.activity=res.value; 
        }else{
  
          console.log("data=&gt;"+val);
          console.log("Json data=&gt;"+JSON.stringify(val));       
          console.log("data are equal");
  
        }
  
      });
  
  
    })
      .catch(e =&gt; {
        // alert("Health QUERY" + JSON.stringify(e));
        console.log("************ 5.HEALTH steps DATA ERROR" + e);
      });
  }
  </code></pre>
  
  <p>}</p>