728x90
환경
- macOS Catalina
- cordova 9.0.0
- cordova platform android 9.0.0
plugin 설치
cordova plugin add cordova-plugin-network-information
사용방법
if(navigator.connection.type == Connection.NONE){
console.log('인터넷 연결이 되지 않음 :( ');
}else{
console.log('인터넷 연결 되어있음 /0/');
}
위와 같이 쉽게 사용할 수 있으며 navigator.connection.type 을 출력했을 때 나오는 값은 다음과 같습니다
Connection.UNKNOWN // Unknown connection
Connection.ETHERNET // Ethernet connection
Connection.WIFI // WiFi connection
Connection.CELL_2G // Cell 2G connection
Connection.CELL_3G // Cell 3G connection
Connection.CELL_4G // Cell 4G connection
Connection.CELL // Cell generic connection
Connection.NONE // No network connection
참고 및 출처
728x90
'FRAMEWORK > CORDOVA' 카테고리의 다른 글
splash 및 app icon 크기 자동 변환 사이트 (0) | 2020.03.13 |
---|---|
INAPPBROWER에서 값 받아오기 (0) | 2020.03.05 |
내가 만든 웹페이지에서 회원탈퇴시 페이스북 권한 해제 하기 (2) | 2020.01.30 |
Cordova로 Facebook Login을 연동해보자! (0) | 2020.01.29 |
PhoneGap html 및 css 반영안될때 (0) | 2020.01.09 |