$ ionicHistory.clear History () does not work android 6.0 and higher

1

I'm using Ionic 1 for the development of an application, and it works without any problem in Android 5.1 or lower, but on devices that have Android 6.0 or higher, it does not work deleting the browsing history, nor does it work the capture of the button backwards, my code is as follows.

Specification of the module

angular.module('historialApp', ['ionic', 'ngCordova'])
    .controller('borrarHistorial', borrarHistorial)
    .factory('salirApp', salirApp);

Controller

borrarHistorial.$inject = ['$scope', '$ionicHistory', 'salirApp', '$ionicPopup', '$state', '$timeout', '$window'];

function borrarHistorial($scope, $ionicHistory, salirApp, $ionicPopup, $state, $timeout, $window) {

    salirApp.salida();
    $ionicHistory.clearHistory();

}

Factory

salirApp.$inject = ['$ionicPlatform', '$ionicHistory', '$timeout', '$cordovaSQLite'];

function salirApp($ionicPlatform, $ionicHistory, $timeout, $cordovaSQLite) {

    function salida() {

        var BackButton = 0;

        $ionicPlatform.registerBackButtonAction(function() {

            if ($ionicHistory.currentStateName() === 'menuestu' || $ionicHistory.currentStateName() === 'menuprof') {

                if (BackButton === 0) {

                    BackButton++;
                    window.plugins.toast.showLongCenter('Presione nuevamente para salir');

                    $timeout(function() {
                        BackButton = 0;
                    }, 2500);

                } else {
                    navigator.app.exitApp();
                }

            } else {
                if ($ionicHistory.currentStateName() === 'login') {
                    navigator.app.exitApp();
                } else {
                    $ionicHistory.goBack();
                }
            }

        }, 100);

    }
}
    
asked by Pedro Miguel Pimienta Morales 05.06.2017 в 01:49
source

0 answers