Function doesn't work on background

I made function and put it into $scope.$on(’$ionicView.enter’, function() { …});

I added background plugin but my function does’t work on background
if I don’t put this function into $scope.$on(’$ionicView.enter’, function() { …});
page will error

I tried to put it into document.addEventListener(“pause”, function() {});
app did’t error but function still does’t work on background
Can someone teach me what should I do please?