$ionicPlatform.ready behaves differently in different devices

Hi,

I have a connectionService wich returns info about device network like this:

.factory('connection', function () {
        return {
            isOnline: function () {
                return navigator.connection.type !== Connection.NONE;
            },
            isWifi: function () {
                return navigator.connection.type === Connection.WIFI ||
                       navigator.connection.type === 'Connection.WIFI';
            },
            isCell: function () {
                return navigator.connection.type === Connection.CELL    ||
                       navigator.connection.type === Connection.CELL_2G ||
                       navigator.connection.type === Connection.CELL_3G ||
                       navigator.connection.type === Connection.CELL_4G;
            }
        }
    });

On LG G2 everything works fine but on Samsung note 4 and iOS Simulator navigator.connection.type is undefined. I resolved the problem wrapping the return in $ionicPlatform.ready like this:

...
 isOnline: function () {
                    $ionicPlatform.ready(function () {
                         return navigator.connection.type !== Connection.NONE; 
                    });
                },

in Samsung Note 4 and iOS it seems device isn’t ready already when I call ‘isOnline()’

The only solution is to wrappe all returns of my service in $ionicPlatform.ready ?

Thanks :slight_smile:

manual boostrapping after device is ready solved the problems