Added network detection, and permission for network state detection