mirror of
https://gitee.com/shuto/cordova-plugin-network-information.git
synced 2025-03-15 12:51:00 +08:00
Lisa testing pulling in plugins for plugin: cordova-plugin-network-information
This commit is contained in:
parent
d327384b56
commit
a8fbf0e92d
@ -37,6 +37,7 @@ Este plugin proporciona una implementación de una versión antigua de la [Red d
|
|||||||
* Windows Phone 7 y 8
|
* Windows Phone 7 y 8
|
||||||
* Tizen
|
* Tizen
|
||||||
* Windows 8
|
* Windows 8
|
||||||
|
* Firefox OS
|
||||||
|
|
||||||
# Conexión
|
# Conexión
|
||||||
|
|
||||||
@ -104,6 +105,11 @@ Hasta Cordova 2.3.0, el `Connection` objeto se accede a través de `navigator.ne
|
|||||||
* Tizen sólo puede detectar un Wi-Fi o conexión celular.
|
* Tizen sólo puede detectar un Wi-Fi o conexión celular.
|
||||||
* `navigator.connection.type`se establece en `Connection.CELL_2G` para todos los datos celulares.
|
* `navigator.connection.type`se establece en `Connection.CELL_2G` para todos los datos celulares.
|
||||||
|
|
||||||
|
### Firefox OS rarezas
|
||||||
|
|
||||||
|
* Firefox OS no puede detectar el tipo de conexión de red celular.
|
||||||
|
* `navigator.connection.type`se establece en `Connection.CELL` para todos los datos celulares.
|
||||||
|
|
||||||
# Eventos relacionados con la red
|
# Eventos relacionados con la red
|
||||||
|
|
||||||
## offline
|
## offline
|
||||||
@ -121,9 +127,11 @@ Las aplicaciones normalmente deben utilizar `document.addEventListener` para con
|
|||||||
|
|
||||||
### Ejemplo rápido
|
### Ejemplo rápido
|
||||||
|
|
||||||
document.addEventListener ("offline", onOffline, false);
|
document.addEventListener("offline", onOffline, false);
|
||||||
|
|
||||||
function onOffline() {/ / Handle del evento offline}
|
function onOffline() {
|
||||||
|
// Handle the offline event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### iOS rarezas
|
### iOS rarezas
|
||||||
|
@ -37,6 +37,7 @@ Ce plugin fournit une implémentation d'une ancienne version de l' [API Informat
|
|||||||
* Windows Phone 7 et 8
|
* Windows Phone 7 et 8
|
||||||
* Paciarelli
|
* Paciarelli
|
||||||
* Windows 8
|
* Windows 8
|
||||||
|
* Firefox OS
|
||||||
|
|
||||||
# Connexion
|
# Connexion
|
||||||
|
|
||||||
@ -104,6 +105,11 @@ Jusqu'à Cordova 2.3.0, l'objet `Connection` était accessible via `navigator.ne
|
|||||||
* Paciarelli peut uniquement détecter une connexion cellulaire ou bien WiFi.
|
* Paciarelli peut uniquement détecter une connexion cellulaire ou bien WiFi.
|
||||||
* `navigator.connection.type`a la valeur `Connection.CELL_2G` pour toutes les données cellulaires.
|
* `navigator.connection.type`a la valeur `Connection.CELL_2G` pour toutes les données cellulaires.
|
||||||
|
|
||||||
|
### Firefox OS Quirks
|
||||||
|
|
||||||
|
* Firefox OS ne peut pas détecter le type de connexion au réseau cellulaire.
|
||||||
|
* `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires.
|
||||||
|
|
||||||
# Événements liés au réseau
|
# Événements liés au réseau
|
||||||
|
|
||||||
## offline
|
## offline
|
||||||
|
181
doc/it/index.md
Normal file
181
doc/it/index.md
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<!---
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# org.apache.cordova.network-information
|
||||||
|
|
||||||
|
Questo plugin fornisce un'implementazione di una vecchia versione dell' [API di informazioni di rete][1]. Fornisce informazioni sul dispositivo cellulare e connessione wifi, e se il dispositivo dispone di una connessione internet.
|
||||||
|
|
||||||
|
[1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/
|
||||||
|
|
||||||
|
## Installazione
|
||||||
|
|
||||||
|
cordova plugin add org.apache.cordova.network-information
|
||||||
|
|
||||||
|
|
||||||
|
## Piattaforme supportate
|
||||||
|
|
||||||
|
* Amazon fuoco OS
|
||||||
|
* Android
|
||||||
|
* BlackBerry 10
|
||||||
|
* iOS
|
||||||
|
* Windows Phone 7 e 8
|
||||||
|
* Tizen
|
||||||
|
* Windows 8
|
||||||
|
* Firefox OS
|
||||||
|
|
||||||
|
# Connessione
|
||||||
|
|
||||||
|
> Il `connection` oggetto, esposto tramite `navigator.connection` , fornisce informazioni sulla connessione wifi e cellulare del dispositivo.
|
||||||
|
|
||||||
|
## Proprietà
|
||||||
|
|
||||||
|
* connection.type
|
||||||
|
|
||||||
|
## Costanti
|
||||||
|
|
||||||
|
* Connection.UNKNOWN
|
||||||
|
* Connection.ETHERNET
|
||||||
|
* Connection.WIFI
|
||||||
|
* Connection.CELL_2G
|
||||||
|
* Connection.CELL_3G
|
||||||
|
* Connection.CELL_4G
|
||||||
|
* Connection.CELL
|
||||||
|
* Connection.NONE
|
||||||
|
|
||||||
|
## connection.type
|
||||||
|
|
||||||
|
Questa proprietà offre un modo rapido per determinare stato della connessione di rete del dispositivo e il tipo di connessione.
|
||||||
|
|
||||||
|
### Esempio rapido
|
||||||
|
|
||||||
|
function checkConnection() {
|
||||||
|
var networkState = navigator.connection.type;
|
||||||
|
|
||||||
|
var states = {};
|
||||||
|
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||||
|
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||||
|
states[Connection.WIFI] = 'WiFi connection';
|
||||||
|
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||||
|
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||||
|
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||||
|
states[Connection.CELL] = 'Cell generic connection';
|
||||||
|
states[Connection.NONE] = 'No network connection';
|
||||||
|
|
||||||
|
alert('Connection type: ' + states[networkState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkConnection();
|
||||||
|
|
||||||
|
|
||||||
|
### Cambiamento di API
|
||||||
|
|
||||||
|
Fino a Cordova 2.3.0, il `Connection` oggetto era accessibile tramite `navigator.network.connection` , dopo che è stato cambiato in `navigator.connection` per abbinare la specifica W3C. È ancora disponibile nella sua posizione originale, ma è obsoleto e verrà rimosso alla fine.
|
||||||
|
|
||||||
|
### iOS stranezze
|
||||||
|
|
||||||
|
* iOS non è possibile rilevare il tipo di connessione di rete cellulare.
|
||||||
|
* `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare.
|
||||||
|
|
||||||
|
### Stranezze di Windows Phone
|
||||||
|
|
||||||
|
* Quando è in esecuzione nell'emulatore, rileva sempre `navigator.connection.type` come`Connection.UNKNOWN`.
|
||||||
|
|
||||||
|
* Windows Phone non riesce a rilevare il tipo di connessione di rete cellulare.
|
||||||
|
|
||||||
|
* `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare.
|
||||||
|
|
||||||
|
### Tizen stranezze
|
||||||
|
|
||||||
|
* Tizen può rilevare solo un WiFi o una connessione cellulare.
|
||||||
|
* `navigator.connection.type`è impostata su `Connection.CELL_2G` per tutti i dati cellulare.
|
||||||
|
|
||||||
|
### Firefox OS stranezze
|
||||||
|
|
||||||
|
* Sistema operativo Firefox non riesce a rilevare il tipo di connessione di rete cellulare.
|
||||||
|
* `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare.
|
||||||
|
|
||||||
|
# Eventi relativi alla rete
|
||||||
|
|
||||||
|
## offline
|
||||||
|
|
||||||
|
L'evento viene generato quando un'applicazione passa alla modalità offline, e il dispositivo non è connesso a Internet.
|
||||||
|
|
||||||
|
document.addEventListener("offline", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### Dettagli
|
||||||
|
|
||||||
|
Il `offline` evento viene generato quando un dispositivo precedentemente connesso perde una connessione di rete in modo che un'applicazione non è più possibile accedere a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene attivato quando il `connection.type` cambia da `NONE` a qualsiasi altro valore.
|
||||||
|
|
||||||
|
Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi.
|
||||||
|
|
||||||
|
### Esempio rapido
|
||||||
|
|
||||||
|
document.addEventListener("offline", onOffline, false);
|
||||||
|
|
||||||
|
function onOffline() {
|
||||||
|
// Handle the offline event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS stranezze
|
||||||
|
|
||||||
|
Durante l'avvio iniziale, il primo evento offline (se applicabile) richiede almeno un secondo al fuoco.
|
||||||
|
|
||||||
|
### Windows Phone 7 capricci
|
||||||
|
|
||||||
|
Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco.
|
||||||
|
|
||||||
|
### Windows Phone 8 stranezze
|
||||||
|
|
||||||
|
L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, così fa l'evento *non* fuoco.
|
||||||
|
|
||||||
|
## online
|
||||||
|
|
||||||
|
Questo evento viene generato quando un'applicazione va online, e il dispositivo diventa collegato a Internet.
|
||||||
|
|
||||||
|
document.addEventListener("online", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### Dettagli
|
||||||
|
|
||||||
|
Il `online` evento viene generato quando un dispositivo precedentemente scollegato riceve una connessione di rete per consentire un'accesso di applicazione a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene generato quando il valore di `connection.type` diventa`NONE`.
|
||||||
|
|
||||||
|
Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi.
|
||||||
|
|
||||||
|
### Esempio rapido
|
||||||
|
|
||||||
|
document.addEventListener("online", onOnline, false);
|
||||||
|
|
||||||
|
function onOnline() {
|
||||||
|
// Handle the online event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS stranezze
|
||||||
|
|
||||||
|
Durante l'avvio iniziale, il primo `online` evento (se applicabile) richiede almeno un secondo al fuoco, prima che `connection.type` è`UNKNOWN`.
|
||||||
|
|
||||||
|
### Windows Phone 7 capricci
|
||||||
|
|
||||||
|
Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco.
|
||||||
|
|
||||||
|
### Windows Phone 8 stranezze
|
||||||
|
|
||||||
|
L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, quindi, non gli eventi *non* a fuoco.
|
181
doc/ko/index.md
Normal file
181
doc/ko/index.md
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<!---
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# org.apache.cordova.network-information
|
||||||
|
|
||||||
|
이 플러그인 [네트워크 정보 API][1]의 이전 버전에 대 한 구현을 제공합니다. 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다 장치는 인터넷 연결에 있는지 여부.
|
||||||
|
|
||||||
|
[1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/
|
||||||
|
|
||||||
|
## 설치
|
||||||
|
|
||||||
|
cordova plugin add org.apache.cordova.network-information
|
||||||
|
|
||||||
|
|
||||||
|
## 지원 되는 플랫폼
|
||||||
|
|
||||||
|
* 아마존 화재 운영 체제
|
||||||
|
* 안 드 로이드
|
||||||
|
* 블랙베리 10
|
||||||
|
* iOS
|
||||||
|
* Windows Phone 7과 8
|
||||||
|
* Tizen
|
||||||
|
* 윈도우 8
|
||||||
|
* Firefox 운영 체제
|
||||||
|
|
||||||
|
# 연결
|
||||||
|
|
||||||
|
> `connection`개체를 통해 노출 `navigator.connection` , 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다.
|
||||||
|
|
||||||
|
## 속성
|
||||||
|
|
||||||
|
* connection.type
|
||||||
|
|
||||||
|
## 상수
|
||||||
|
|
||||||
|
* Connection.UNKNOWN
|
||||||
|
* Connection.ETHERNET
|
||||||
|
* Connection.WIFI
|
||||||
|
* Connection.CELL_2G
|
||||||
|
* Connection.CELL_3G
|
||||||
|
* Connection.CELL_4G
|
||||||
|
* Connection.CELL
|
||||||
|
* Connection.NONE
|
||||||
|
|
||||||
|
## connection.type
|
||||||
|
|
||||||
|
이 디바이스의 네트워크 연결 상태를 확인 하는 빠른 방법을 제공 합니다 및 연결의 종류.
|
||||||
|
|
||||||
|
### 빠른 예제
|
||||||
|
|
||||||
|
function checkConnection() {
|
||||||
|
var networkState = navigator.connection.type;
|
||||||
|
|
||||||
|
var states = {};
|
||||||
|
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||||
|
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||||
|
states[Connection.WIFI] = 'WiFi connection';
|
||||||
|
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||||
|
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||||
|
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||||
|
states[Connection.CELL] = 'Cell generic connection';
|
||||||
|
states[Connection.NONE] = 'No network connection';
|
||||||
|
|
||||||
|
alert('Connection type: ' + states[networkState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkConnection();
|
||||||
|
|
||||||
|
|
||||||
|
### API 변경
|
||||||
|
|
||||||
|
코르 도우 바 2.3.0까지 `Connection` 개체를 통해 액세스 했습니다 `navigator.network.connection` , 후에 변경 된 `navigator.connection` W3C 사양에 맞게. 그것은 그것의 원래 위치에 계속 사용할 수 하지만 사용 되지 않습니다 및 결국 제거 될 것 이다.
|
||||||
|
|
||||||
|
### iOS 단점
|
||||||
|
|
||||||
|
* iOS는 셀룰러 네트워크 연결의 종류를 감지할 수 없습니다.
|
||||||
|
* `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한.
|
||||||
|
|
||||||
|
### Windows Phone 단점
|
||||||
|
|
||||||
|
* 에뮬레이터에서 실행할 때 항상 검색 `navigator.connection.type` 으로`Connection.UNKNOWN`.
|
||||||
|
|
||||||
|
* Windows Phone 셀룰러 네트워크 연결 유형을 검색할 수 없습니다.
|
||||||
|
|
||||||
|
* `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한.
|
||||||
|
|
||||||
|
### Tizen 특수
|
||||||
|
|
||||||
|
* Tizen은 와이파이 또는 휴대 전화 연결에만 검색할 수 있습니다.
|
||||||
|
* `navigator.connection.type`로 설정 된 `Connection.CELL_2G` 모든 셀룰러 데이터에 대 한.
|
||||||
|
|
||||||
|
### 파이어 폭스 OS 단점
|
||||||
|
|
||||||
|
* 파이어 폭스 OS 셀룰러 네트워크 연결 유형을 검색할 수 없습니다.
|
||||||
|
* `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한.
|
||||||
|
|
||||||
|
# 네트워크 관련 이벤트
|
||||||
|
|
||||||
|
## offline
|
||||||
|
|
||||||
|
이벤트가 발생 하면 응용 프로그램 오프 라인, 이동 및 장치가 인터넷에 연결 되어 있지.
|
||||||
|
|
||||||
|
document.addEventListener("offline", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### 세부 정보
|
||||||
|
|
||||||
|
`offline`이벤트가 발생 하면 응용 프로그램이 더 이상 인터넷에 액세스할 수 있도록 이전 연결 된 장치가 네트워크 연결 손실. 그것은 연결 API와 동일한 정보에 의존 하 고 경우에 `connection.type` 에서 변경 `NONE` 다른 값으로.
|
||||||
|
|
||||||
|
일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다.
|
||||||
|
|
||||||
|
### 빠른 예제
|
||||||
|
|
||||||
|
document.addEventListener("offline", onOffline, false);
|
||||||
|
|
||||||
|
function onOffline() {
|
||||||
|
// Handle the offline event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS 단점
|
||||||
|
|
||||||
|
처음 시작 하는 동안 첫 번째 오프 라인 이벤트 (있는 경우)를 적어도 초를 걸립니다.
|
||||||
|
|
||||||
|
### Windows Phone 7 단점
|
||||||
|
|
||||||
|
에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불.
|
||||||
|
|
||||||
|
### Windows Phone 8 단점
|
||||||
|
|
||||||
|
에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불.
|
||||||
|
|
||||||
|
## online
|
||||||
|
|
||||||
|
응용 프로그램은 온라인 및 장치가 인터넷에 연결 된다 때이 이벤트가 발생 합니다.
|
||||||
|
|
||||||
|
document.addEventListener("online", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### 세부 정보
|
||||||
|
|
||||||
|
`online`이전 연결 되지 않은 장치는 인터넷에 대 한 응용 프로그램 액세스를 허용 하도록 네트워크 연결을 받을 때 이벤트가 발생 합니다. 그것은 연결 API와 동일한 정보에 의존 하 고 경우의 값 `connection.type` 된다`NONE`.
|
||||||
|
|
||||||
|
일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다.
|
||||||
|
|
||||||
|
### 빠른 예제
|
||||||
|
|
||||||
|
document.addEventListener("online", onOnline, false);
|
||||||
|
|
||||||
|
function onOnline() {
|
||||||
|
// Handle the online event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS 단점
|
||||||
|
|
||||||
|
처음 시작 하는 동안 첫 번째 `online` 이벤트 (있는 경우) 이전에 불 초 걸립니다 이상 `connection.type` 입니다`UNKNOWN`.
|
||||||
|
|
||||||
|
### Windows Phone 7 단점
|
||||||
|
|
||||||
|
에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불.
|
||||||
|
|
||||||
|
### Windows Phone 8 단점
|
||||||
|
|
||||||
|
에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불.
|
181
doc/pl/index.md
Normal file
181
doc/pl/index.md
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<!---
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# org.apache.cordova.network-information
|
||||||
|
|
||||||
|
Wtyczka stanowi implementację starą wersję [API informacji w sieci][1]. Udostępnia informacje na temat urządzenia komórkowe i wifi połączenie, i czy urządzenie ma połączenie z Internetem.
|
||||||
|
|
||||||
|
[1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/
|
||||||
|
|
||||||
|
## Instalacji
|
||||||
|
|
||||||
|
cordova plugin add org.apache.cordova.network-information
|
||||||
|
|
||||||
|
|
||||||
|
## Obsługiwane platformy
|
||||||
|
|
||||||
|
* Amazon ogień OS
|
||||||
|
* Android
|
||||||
|
* Jeżyna 10
|
||||||
|
* iOS
|
||||||
|
* Windows Phone 7 i 8
|
||||||
|
* Tizen
|
||||||
|
* Windows 8
|
||||||
|
* Firefox OS
|
||||||
|
|
||||||
|
# Połączenie
|
||||||
|
|
||||||
|
> `connection`Obiektu, wystawiony przez `navigator.connection` , zawiera informacje o połączeniu urządzenia komórkowe i wifi.
|
||||||
|
|
||||||
|
## Właściwości
|
||||||
|
|
||||||
|
* Connection.Type
|
||||||
|
|
||||||
|
## Stałe
|
||||||
|
|
||||||
|
* Connection.UNKNOWN
|
||||||
|
* Connection.ETHERNET
|
||||||
|
* Connection.WIFI
|
||||||
|
* Connection.CELL_2G
|
||||||
|
* Connection.CELL_3G
|
||||||
|
* Connection.CELL_4G
|
||||||
|
* Connection.CELL
|
||||||
|
* Connection.NONE
|
||||||
|
|
||||||
|
## Connection.Type
|
||||||
|
|
||||||
|
Oferuje szybki sposób ustalić stan połączenia sieciowego urządzenia i typ połączenia.
|
||||||
|
|
||||||
|
### Szybki przykład
|
||||||
|
|
||||||
|
function checkConnection() {
|
||||||
|
var networkState = navigator.connection.type;
|
||||||
|
|
||||||
|
var states = {};
|
||||||
|
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||||
|
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||||
|
states[Connection.WIFI] = 'WiFi connection';
|
||||||
|
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||||
|
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||||
|
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||||
|
states[Connection.CELL] = 'Cell generic connection';
|
||||||
|
states[Connection.NONE] = 'No network connection';
|
||||||
|
|
||||||
|
alert('Connection type: ' + states[networkState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkConnection();
|
||||||
|
|
||||||
|
|
||||||
|
### Zmiana interfejsu API
|
||||||
|
|
||||||
|
Do Cordova 2.3.0 `Connection` obiekt uzyskano za pośrednictwem `navigator.network.connection` , po którym został zmieniony na `navigator.connection` odpowiadać specyfikacji W3C. To jest nadal dostępne w jego oryginalnej lokalizacji, ale jest niezalecane i zostaną ostatecznie usunięte.
|
||||||
|
|
||||||
|
### iOS dziwactwa
|
||||||
|
|
||||||
|
* iOS nie może wykryć typ połączenia w sieci komórkowej.
|
||||||
|
* `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych.
|
||||||
|
|
||||||
|
### Windows Phone dziwactwa
|
||||||
|
|
||||||
|
* Po uruchomieniu w emulatorze, zawsze wykrywa `navigator.connection.type` jako`Connection.UNKNOWN`.
|
||||||
|
|
||||||
|
* Windows Phone nie może wykryć typ połączenia w sieci komórkowej.
|
||||||
|
|
||||||
|
* `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych.
|
||||||
|
|
||||||
|
### Osobliwości Tizen
|
||||||
|
|
||||||
|
* Tizen można tylko dostrzegać Wi-Fi lub połączenia komórkowe.
|
||||||
|
* `navigator.connection.type`jest zestaw `Connection.CELL_2G` dla wszystkich komórek danych.
|
||||||
|
|
||||||
|
### Firefox OS dziwactwa
|
||||||
|
|
||||||
|
* Firefox OS nie można wykryć typ połączenia w sieci komórkowej.
|
||||||
|
* `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych.
|
||||||
|
|
||||||
|
# Zdarzenia związane z sieci
|
||||||
|
|
||||||
|
## offline
|
||||||
|
|
||||||
|
Zdarzenie odpala gdy aplikacja przejdzie do trybu offline, a urządzenie nie jest podłączone do Internetu.
|
||||||
|
|
||||||
|
document.addEventListener("offline", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### Szczegóły
|
||||||
|
|
||||||
|
`offline`Zdarzenie fires po wcześniej podłączone urządzenie traci połączenia z siecią, dzięki czemu aplikacja może już dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam `connection.type` zmienia się z `NONE` na inną wartość.
|
||||||
|
|
||||||
|
Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia.
|
||||||
|
|
||||||
|
### Szybki przykład
|
||||||
|
|
||||||
|
document.addEventListener("offline", onOffline, false);
|
||||||
|
|
||||||
|
function onOffline() {
|
||||||
|
// Handle the offline event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS dziwactwa
|
||||||
|
|
||||||
|
Podczas uruchamiania systemu pierwsza impreza offline (jeśli dotyczy) trwa co najmniej drugi ognia.
|
||||||
|
|
||||||
|
### Windows Phone 7 dziwactwa
|
||||||
|
|
||||||
|
Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień.
|
||||||
|
|
||||||
|
### Windows Phone 8 dziwactwa
|
||||||
|
|
||||||
|
Emulator raporty typ połączenia, jako `Cellular` , co nie zmienia, więc zdarzenie *nie* ogień.
|
||||||
|
|
||||||
|
## online
|
||||||
|
|
||||||
|
Wydarzenie to odpala gdy aplikacja przechodzi w tryb online i urządzenie staje się połączenie z Internetem.
|
||||||
|
|
||||||
|
document.addEventListener("online", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### Szczegóły
|
||||||
|
|
||||||
|
`online`Zdarzenie odpala gdy wcześniej niezwiązane urządzenie odbiera połączenie sieciowe, aby umożliwić aplikacji dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam wartość `connection.type` staje się`NONE`.
|
||||||
|
|
||||||
|
Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia.
|
||||||
|
|
||||||
|
### Szybki przykład
|
||||||
|
|
||||||
|
document.addEventListener("online", onOnline, false);
|
||||||
|
|
||||||
|
function onOnline() {
|
||||||
|
// Handle the online event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS dziwactwa
|
||||||
|
|
||||||
|
Podczas uruchamiania systemu pierwszy `online` zdarzenia (w stosownych przypadkach) zajmuje co najmniej drugie ognia, przed którym `connection.type` jest`UNKNOWN`.
|
||||||
|
|
||||||
|
### Windows Phone 7 dziwactwa
|
||||||
|
|
||||||
|
Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień.
|
||||||
|
|
||||||
|
### Windows Phone 8 dziwactwa
|
||||||
|
|
||||||
|
Emulator sprawozdania jako typ połączenia `Cellular` , które nie zmienia, więc wydarzenia czy *nie* ogień.
|
181
doc/zh/index.md
Normal file
181
doc/zh/index.md
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<!---
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# org.apache.cordova.network-information
|
||||||
|
|
||||||
|
這個外掛程式提供的舊版本的[網路資訊 API][1]實現的。 它提供了有關該設備的行動電話和無線網路連接的資訊和設備是否已連接到 internet。
|
||||||
|
|
||||||
|
[1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/
|
||||||
|
|
||||||
|
## 安裝
|
||||||
|
|
||||||
|
cordova plugin add org.apache.cordova.network-information
|
||||||
|
|
||||||
|
|
||||||
|
## 支援的平臺
|
||||||
|
|
||||||
|
* 亞馬遜火 OS
|
||||||
|
* Android 系統
|
||||||
|
* 黑莓 10
|
||||||
|
* iOS
|
||||||
|
* Windows Phone 7 和 8
|
||||||
|
* Tizen
|
||||||
|
* Windows 8
|
||||||
|
* 火狐瀏覽器作業系統
|
||||||
|
|
||||||
|
# 連接
|
||||||
|
|
||||||
|
> `connection`物件,通過公開 `navigator.connection` ,提供了有關該設備的行動電話和無線網路連接的資訊。
|
||||||
|
|
||||||
|
## 屬性
|
||||||
|
|
||||||
|
* connection.type
|
||||||
|
|
||||||
|
## 常量
|
||||||
|
|
||||||
|
* Connection.UNKNOWN
|
||||||
|
* Connection.ETHERNET
|
||||||
|
* Connection.WIFI
|
||||||
|
* Connection.CELL_2G
|
||||||
|
* Connection.CELL_3G
|
||||||
|
* Connection.CELL_4G
|
||||||
|
* Connection.CELL
|
||||||
|
* Connection.NONE
|
||||||
|
|
||||||
|
## connection.type
|
||||||
|
|
||||||
|
此屬性提供快速的方法來確定設備的網路連接狀態,和連線類型。
|
||||||
|
|
||||||
|
### 快速的示例
|
||||||
|
|
||||||
|
function checkConnection() {
|
||||||
|
var networkState = navigator.connection.type;
|
||||||
|
|
||||||
|
var states = {};
|
||||||
|
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||||
|
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||||
|
states[Connection.WIFI] = 'WiFi connection';
|
||||||
|
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||||
|
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||||
|
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||||
|
states[Connection.CELL] = 'Cell generic connection';
|
||||||
|
states[Connection.NONE] = 'No network connection';
|
||||||
|
|
||||||
|
alert('Connection type: ' + states[networkState]);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkConnection();
|
||||||
|
|
||||||
|
|
||||||
|
### API 更改
|
||||||
|
|
||||||
|
科爾多瓦 2.3.0,直到 `Connection` 物件的訪問通過 `navigator.network.connection` 後才改為其中, `navigator.connection` 以匹配的 W3C 規範。 它在其原始位置,是仍然可用,但已廢棄,最終將被刪除。
|
||||||
|
|
||||||
|
### iOS 的怪癖
|
||||||
|
|
||||||
|
* iOS 無法檢測到蜂窩網路連接的類型。
|
||||||
|
* `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。
|
||||||
|
|
||||||
|
### Windows Phone 怪癖
|
||||||
|
|
||||||
|
* 當運行在模擬器中,總能檢測到 `navigator.connection.type` 作為`Connection.UNKNOWN`.
|
||||||
|
|
||||||
|
* Windows Phone 不能檢測的蜂窩網路連接的類型。
|
||||||
|
|
||||||
|
* `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。
|
||||||
|
|
||||||
|
### Tizen 怪癖
|
||||||
|
|
||||||
|
* Tizen 只可以檢測一個 WiFi 或者蜂窩連接。
|
||||||
|
* `navigator.connection.type`設置為 `Connection.CELL_2G` 為所有蜂窩資料。
|
||||||
|
|
||||||
|
### 火狐瀏覽器作業系統的怪癖
|
||||||
|
|
||||||
|
* 火狐瀏覽器作業系統無法檢測到蜂窩網路連接的類型。
|
||||||
|
* `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。
|
||||||
|
|
||||||
|
# 與網路相關的事件
|
||||||
|
|
||||||
|
## offline
|
||||||
|
|
||||||
|
當一個應用程式離線時,與該設備未連接到互聯網時,將觸發該事件。
|
||||||
|
|
||||||
|
document.addEventListener("offline", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### 詳細資訊
|
||||||
|
|
||||||
|
`offline`以前連接的設備失去網路連接,這樣,應用程式不再可以訪問互聯網時激發的事件。 它依賴于連接 API 中,相同的資訊和火災時 `connection.type` 從更改 `NONE` 為其他任何值。
|
||||||
|
|
||||||
|
應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。
|
||||||
|
|
||||||
|
### 快速的示例
|
||||||
|
|
||||||
|
document.addEventListener("offline", onOffline, false);
|
||||||
|
|
||||||
|
function onOffline() {
|
||||||
|
// Handle the offline event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS 的怪癖
|
||||||
|
|
||||||
|
在初始啟動期間,第一次離線事件 (如果適用) 需至少一秒的火。
|
||||||
|
|
||||||
|
### Windows Phone 7 的怪癖
|
||||||
|
|
||||||
|
當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。
|
||||||
|
|
||||||
|
### Windows Phone 8 怪癖
|
||||||
|
|
||||||
|
模擬程式報告連線類型為 `Cellular` ,而不會更改,所以該事件不會*不*火。
|
||||||
|
|
||||||
|
## online
|
||||||
|
|
||||||
|
當應用程式進入線上狀態,和該設備將成為連接到互聯網時觸發此事件。
|
||||||
|
|
||||||
|
document.addEventListener("online", yourCallbackFunction, false);
|
||||||
|
|
||||||
|
|
||||||
|
### 詳細資訊
|
||||||
|
|
||||||
|
`online`當先前連接的行動裝置接收到一個網路連接以允許應用程式訪問互聯網時激發的事件。 它依賴于連接 API 中,相同的資訊和火災時的值 `connection.type` 成為`NONE`.
|
||||||
|
|
||||||
|
應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。
|
||||||
|
|
||||||
|
### 快速的示例
|
||||||
|
|
||||||
|
document.addEventListener("online", onOnline, false);
|
||||||
|
|
||||||
|
function onOnline() {
|
||||||
|
// Handle the online event
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### iOS 的怪癖
|
||||||
|
|
||||||
|
在初始啟動期間第一次 `online` 事件 (如果適用),至少需一秒的火災之前的, `connection.type` 是`UNKNOWN`.
|
||||||
|
|
||||||
|
### Windows Phone 7 的怪癖
|
||||||
|
|
||||||
|
當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。
|
||||||
|
|
||||||
|
### Windows Phone 8 怪癖
|
||||||
|
|
||||||
|
模擬程式報告連線類型為 `Cellular` ,而不會更改,所以事件不**火。
|
Loading…
x
Reference in New Issue
Block a user