LocalStorage not functioning on Android, works in Browser
<p>I am currently trying to create a Checklist (to-do) app with <strong>Ionic</strong> and <strong>AngularJS</strong> to run on an Android device.</p>

<p>When I test my app in the browser via <code>ionic serve</code>, the data stores fine and comes back fine. However, when running on my Samsung Galaxy Note 5, the app does not seem to function when trying to store data.</p>

<p>Here is my app.js, any help is much appreciated, the parts where I store data and restore data are the parts with <code>var storage</code>.</p>



<pre class="lang-js prettyprint-override"><code>// Ionic Checklist App
angular.module('checklist', ['ionic', 'ngCordova'])


.run(function ($ionicPlatform, TaskService) {
    $ionicPlatform.ready(function () {
        if (cordova.platformId === 'ios' &amp;&amp; window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
            cordova.plugins.Keyboard.disableScroll(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }

    });
    var storage = window.localStorage;
    var tasks = JSON.parse(storage.getItem('tasks'));
    console.log(tasks)
    TaskService.setTasks(tasks);
    console.log("loaded tasks");
})

.controller('TasksCtrl', function ($scope, $ionicModal, $cordovaFile, TaskService) {
    $scope.tasks = TaskService.getTasks();
    var storage = window.localStorage;

    $ionicModal.fromTemplateUrl('newTaskModal',
        {
            scope: $scope,
            animation: 'slide-in-up'
        }).then(function (modal) {
            $scope.modal = modal;
        });

    $scope.openNewTask = function () {
        $scope.modal.show();

    }

    $scope.closeNewTask = function () {
        $scope.modal.hide();
    }

    $scope.newTaskInput = {
        taskName: '',
        taskComments: ''
    }

    $scope.newTask = function () {
        console.log($scope.newTaskInput.taskName);
        TaskService.makeTask($scope.newTaskInput.taskName, $scope.newTaskInput.taskComments);
        storage.setItem('tasks', JSON.stringify($scope.tasks));
        $scope.closeNewTask();
    }

    $scope.deleteTask = function (task) {
        console.log(TaskService.getTasks());
        TaskService.deleteTask(task);
        storage.setItem('tasks', JSON.stringify($scope.tasks));
    }

})

.controller('TaskDetailCtrl', function ($scope, $stateParams, TaskService) {
    $scope.taskId = $stateParams.taskId;
    $scope.task = TaskService.getTask($scope.taskId);
})

.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider) {

    $ionicConfigProvider.navBar.alignTitle('center');

    $stateProvider
        .state('tasks', {
            url: '/',
            templateUrl: 'tasks',
            controller: 'TasksCtrl'
        })
        .state('taskDetail', {
            url: '/:taskId',
            templateUrl: 'taskDetail',
            controller: 'TaskDetailCtrl'
        });

    $urlRouterProvider.otherwise("/");

})

.service('TaskService', function () {
    return {
        //Sample Tasks
        /*tasks: [
        {
            id: '1',
            name: 'Milk',
            comment: 'get it from the Frick Park Market'
        }, 
        {
            id: '2',
            name: 'Eggs',
            comment: 'get from chicken'
        }
        ],*/
        tasks: [],
        setTasks: function(restore) {
            this.tasks = restore;
        },
        makeTask: function(name, comment) {
            var newId = this.tasks.length + 1;
            this.tasks.unshift({
                id: newId,
                name: name,
                comment: comment
            });
        },
        deleteTask: function (task) {
            console.log(task);
            console.log(this.tasks);
            console.log(this.tasks.indexOf(task));
            this.tasks.splice(this.tasks.indexOf(task), 1);
            for (i = 0; i &lt; this.tasks.length; i++) {
                this.tasks[i].id = i+1;
            };
        },
        getTasks: function() {
            return this.tasks;
        },
        getTask: function (taskId) {

            for (i = 0; i &lt; this.tasks.length; i++) {

                if (this.tasks[i].id == taskId) {
                    return this.tasks[i];
                }

            }

        }
    }
})
</code></pre>