简体   繁体   中英

Offline Notification in PhoneGap or Cordova

I already have the ff:

index.html

function onLoad() {
    document.addEventListener("deviceready", onDeviceReady, false);
}

function onDeviceReady() {
    document.addEventListener("offline", onOffline, false);
}

function onOffline() {
    alert('device is offline');
}

body tag

<body onload="onLoad()">

Plugin:

org.apache.cordova.network-information 0.2.12 "Network Information"

Permission:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Config.xml:

<feature name="NetworkStatus">
    <param name="android-package" value="org.apache.cordova.networkinformation.NetworkManager" />
</feature>

But the offline was not triggered. Do I missed something for this?

thanks

Perhaps this will help?

http://docs.phonegap.com/en/2.2.0/cordova_notification_notification.md.html

It looks like you can also use a Toast :

https://build.phonegap.com/plugins/740

I've only ever done native dev, just found these via Google.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM