LTroya LTroya - 5 months ago 151
Android Question

Is there a way to minimize the app to the background with a button inside the app?

Is there a way to minimize the app to the background with a button inside the app?

Some apps do that when you press the exit option. They don't close but put the app in the background...

I want to do that with my Ionic app or with a cordova way.

Answer

I just created a plugin called "AppMinimize" for cordova (only for Android devices) that does what you want. I hope it helps you.


Installation:

cordova plugin add https://github.com/tomloprod/cordova-plugin-appminimize.git

Usage:

window.plugins.appMinimize.minimize();

Ionic Example: Minimize app by pressing back button:

$ionicPlatform.registerBackButtonAction(function (event) {
    event.preventDefault();
    window.plugins.appMinimize.minimize();
}, 100);

Github:

https://github.com/tomloprod/cordova-plugin-appminimize

Comments