def check_state(droid, state, stateold):
    """ Check if environment has changed.
    Args:
        droid: an Android instance.
        state: a string, the present state.
        stateold: a string, the former state.
    Returns:
        a binary true if environment has changed. """
    if state != stateold:
        droid.vibrate()
        if state != 'sconosciuto':
            droid.makeToast('Sei a {}'.format(state))
        else:
            droid.makeToast('Sei uscito da {}'.format(stateold))
        return(True)
    else:
        return(False)