How to prevent restart on resume?

In ionic 1. When the app is put into the background, I’d like to prevent a refresh/reload of the app on resume

I’ve seen that I can listen for resume with the code below, but not sure how to prevent the default functionality of refreshing the app when it resumes.

$ionicPlatform.on(‘resume’, function(){

})

This functionality is currently messing up the state of my app and/bluetooth connections I’m making. Forcing me to restart bluetooth and the app in some cases to get back to normal.

How might prevent a refresh on resume?

You’d need to add the background-mode plugin

ionic plugin add cordova-plugin-background-mode

I think the above is correct but Google is your friend and the readme on the github repo will help you.

HTH

Thanks the response. I’ve actually already tried that and it seams great for running tasks in the background, but still refreshing when I resume things. From what I can tell from the documentation doesn’t seam to mention anything about handling app refresh issues.

I know you can change the app launch mode, like below, which seams to be related, but have yet to have any luck here.

<preference name="AndroidLaunchMode" value="singleTask" />
1 Like

Did you find any solution? Same problem here.

This strikes me as a categorically impossible wish, unless the underlying OS provides the equivalent of hibernation functionality. When your app gets killed, all resources it was using are freed up and reallocated for other tasks. There isn’t anything to resume.