$ionicPlatform.on : 'resume'

Hi guys,
I would like to ask you a question. I’m using The nic raboy code for browse the file system and when I open a PDF file the file system disappear (tested on iOS).
I thought to use the event ‘resume’ to call the “file system builder” again but there is a problem.
When we enter into the app the event don’t know where you was and I don’t know how to reload only the things related to the last view open.
I have tried to use the state to understand where I was but It doesn’t work.

`$ionicPlatform.on(‘pause’, function() {
$rootScope.isInPause = new Date().getTime();
});

$ionicPlatform.on('resume', function() {
  var now = new Date().getTime();
  var diff = now-$rootScope.isInPause;
  if($rootScope.isInPause) {
      if(diff >= 900000) {
          // I have to reload the session and the user have to login 
          $rootScope.session=true;
          $state.go('login');
      } else {
          if($ionicHistory.currentStateName()==='dummyState') {
              $state.go('dummyState');
          }
          if($ionicHistory.currentStateName()==='profile') {
              $rootScope.reloadFileSystem=true;
              $state.go('profile');
          }
      }
    }
    $rootScope.isInPause = 0;
});`

What’s wrong?
Thank you everybody.