added moveToBackground and moveToForeground #1181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat(background-mode): add missing functions moveToBackground and moveToForeground as explained in #1180
Please can you add the following 2 functions into background mode:
cordova.plugins.backgroundMode.moveToBackground();
// or
cordova.plugins.backgroundMode.moveToForeground();
Found here:
https://github.com/katzer/cordova-plugin-background-mode#transit-between-application-states
The reason being is that overrideBackButton (https://github.com/driftyco/ionic-native/blob/master/src/plugins/backgroundmode.ts#L133) works really badly for opened nav pages. Instead of going back to the root it closes the App. However moveToBackground works perfectly when required without interfering with the hardware back button.