cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leutwyler, Markus" <markus.leutwy...@hp.com>
Subject RE: online/offline Events
Date Tue, 13 Nov 2012 14:00:25 GMT
I'm able to successfully setup  a webOS specific service call in the initialize() function
in platform.js ... this will keep track of any connection changes but fires multiple events
in case Wifi is turned on (and not connected to an AP) and then again if connected with an
AP. I convert those events to offline/online document events (via cordova.fireDocumentEvent).
Is there a way to add a global online/offline status/variable somewhere and only fire document
events if there's an actual change from offline to online? 

Markus

-----Original Message-----
From: agrieve@google.com [mailto:agrieve@google.com] On Behalf Of Andrew Grieve
Sent: Mittwoch, 7. November 2012 16:27
To: dev
Subject: Re: online/offline Events

Here's the Android impl:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/src/org/apache/cordova/NetworkManager.java;h=5d8791809227877d604c98cf029c26242d9642b8;hb=HEAD

The JS performs a Connection.getConnectionInfo(), and then the native plugin returns the connection
status but sets "keepCallback" to true. Then, whenever the connection type changes, it sends
another plugin result and always sets keepCallback to true.


On Wed, Nov 7, 2012 at 9:57 AM, Leutwyler, Markus
<markus.leutwyler@hp.com>wrote:

> I saw that ... but how is that handled by the platform specific plugins?
>
> Markus
>
> -----Original Message-----
> From: Simon MacDonald [mailto:simon.macdonald@gmail.com]
> Sent: Mittwoch, 7. November 2012 15:56
> To: dev@cordova.apache.org
> Subject: Re: online/offline Events
>
> lolz I didn't read what list this was on. The src for network.js is at:
>
>
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=b
> lob;f=lib/common/plugin/network.js;h=adaba5ae8b6ec825986712d8b99e66010
> 5e56ae9;hb=HEAD
>
> The way we have it setup is the native side sends the JS side an 
> update whenever the network connection changes. If the type == 'none' 
> then we fire an offline event. Otherwise you fire the online event.
>
> Simon Mac Donald
> http://hi.im/simonmacdonald
>
>
> On Wed, Nov 7, 2012 at 9:47 AM, Leutwyler, Markus
> <markus.leutwyler@hp.com>wrote:
>
> > I was actually looking for a code example (in cordova-js) of a 
> > platform that sends out those events (because I'm investigating how 
> > to add support for those to webOS)
> >
> > Markus
> >
> > -----Original Message-----
> > From: Simon MacDonald [mailto:simon.macdonald@gmail.com]
> > Sent: Mittwoch, 7. November 2012 15:39
> > To: dev@cordova.apache.org
> > Subject: Re: online/offline Events
> >
> > http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#onli
> > ne 
> > http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#offl
> > in
> > e
> >
> > Simon Mac Donald
> > http://hi.im/simonmacdonald
> >
> >
> > On Wed, Nov 7, 2012 at 9:36 AM, Leutwyler, Markus
> > <markus.leutwyler@hp.com>wrote:
> >
> > > Is there a platform that sends out online/offline event to the 
> > > document when the connection status changes? I didn't find any 
> > > examples
> > >
> > > Thanks
> > >
> > > Markus
> > >
> >
>

Mime
View raw message