I have a function that works absolutely fine. I just want to return true or false depending on the promise.
 //I want this function to return a simple true or false!!!
function isAppOnline() {
            var is_connected = connectivityMonitor.isInternetConnected();
            is_connected.then(function(result) {
                console.log('INTERNET_CHECK_API : app online');//works fine
                return true;//this is not being returned
            }, function(error) {
                console.log('INTERNET_CHECK_API : app offline');//works fine
                return false;//this is not being returned
            });
        }
But when I call this function,
is_online = isAppOnline();
is_online is always undefined . Why is the function not able to return a simple boolean value?
Update :
This is what I am trying to do : I simply want to open a popup which notifies the user that he is offline. I am calling the function isAppOnline periodically after 10secs. This function is already using a promise in my factories . I dont want to overcomplicate things but its important to me that this function returns a boolean so based on this,I can take my actions accordingly.
 
     
     
     
     
    