Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43AD1DC87 for ; Wed, 14 Nov 2012 11:35:20 +0000 (UTC) Received: (qmail 89951 invoked by uid 500); 14 Nov 2012 11:35:20 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 89831 invoked by uid 500); 14 Nov 2012 11:35:19 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 89799 invoked by uid 99); 14 Nov 2012 11:35:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2012 11:35:18 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [15.201.24.18] (HELO g4t0015.houston.hp.com) (15.201.24.18) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2012 11:35:10 +0000 Received: from G9W0369G.americas.hpqcorp.net (g9w0369g.houston.hp.com [16.216.193.232]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t0015.houston.hp.com (Postfix) with ESMTPS id E0D368826 for ; Wed, 14 Nov 2012 11:34:48 +0000 (UTC) Received: from G9W0370G.americas.hpqcorp.net (16.216.193.233) by G9W0369G.americas.hpqcorp.net (16.216.193.232) with Microsoft SMTP Server (TLS) id 14.2.283.4; Wed, 14 Nov 2012 11:33:50 +0000 Received: from G9W0729.americas.hpqcorp.net ([169.254.9.36]) by G9W0370G.americas.hpqcorp.net ([16.216.193.233]) with mapi id 14.02.0283.004; Wed, 14 Nov 2012 11:33:02 +0000 From: "Leutwyler, Markus" To: "dev@cordova.apache.org" Subject: RE: online/offline Events Thread-Topic: online/offline Events Thread-Index: Ac289SueqHh7DupZTE6oejSYa4oLbwAAH8MAAABBX7AAAFA3gAAADxlwAAEJ8IABKp+/QAAHzqwAACVhzGA= Date: Wed, 14 Nov 2012 11:33:50 +0000 Message-ID: <7EC783583A3638449E13002CFE331D3A32D26416@G9W0729.americas.hpqcorp.net> References: <7EC783583A3638449E13002CFE331D3A32D2384B@G9W0729.americas.hpqcorp.net> <7EC783583A3638449E13002CFE331D3A32D23A76@G9W0729.americas.hpqcorp.net> <7EC783583A3638449E13002CFE331D3A32D23AA2@G9W0729.americas.hpqcorp.net> <7EC783583A3638449E13002CFE331D3A32D25E8C@G9W0729.americas.hpqcorp.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [15.201.58.26] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org In lib/common/plugin/network.js on Line 49 if (info =3D=3D=3D "none") { Am I wrong or will this statement never be true since the plugins return th= e connection as "Connection.NONE"? What I'm seeing is that the event online is fired as Connection.NONE is pas= sed in Markus -----Original Message----- From: agrieve@google.com [mailto:agrieve@google.com] On Behalf Of Andrew Gr= ieve Sent: Dienstag, 13. November 2012 18:41 To: dev Subject: Re: online/offline Events The spec says to fire an online event whenever the connection type changes,= and to fire an offline event only when you lose your connection. It's not = the most obvious, but probably your multiple event firing is working as int= ended. To answer your second question, I think what you're looking for is navigato= r.onLine. It's derived from the connection type here: https://git-wip-us.apache.org/repos/asf?p=3Dincubator-cordova-js.git;a=3Dbl= ob;f=3Dlib/common/plugin/network.js;h=3D63736a954762b17d4383239a8afa46a81ce= 88a3a;hb=3DHEAD#l31 On Tue, Nov 13, 2012 at 9:00 AM, Leutwyler, Markus wrote: > I'm able to successfully setup a webOS specific service call in the > initialize() function in platform.js ... this will keep track of any=20 > connection changes but fires multiple events in case Wifi is turned on=20 > (and not connected to an AP) and then again if connected with an AP. I=20 > convert those events to offline/online document events (via=20 > cordova.fireDocumentEvent). Is there a way to add a global=20 > online/offline status/variable somewhere and only fire document events=20 > if there's an actual change from offline to online? > > Markus > > -----Original Message----- > From: agrieve@google.com [mailto:agrieve@google.com] On Behalf Of=20 > 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=3Dincubator-cordova-android.gi > t;a=3Dblob;f=3Dframework/src/org/apache/cordova/NetworkManager.java;h=3D5= d87 > 91809227877d604c98cf029c26242d9642b8;hb=3DHEAD > > The JS performs a Connection.getConnectionInfo(), and then the native=20 > plugin returns the connection status but sets "keepCallback" to true.=20 > Then, whenever the connection type changes, it sends another plugin=20 > result and always sets keepCallback to true. > > > On Wed, Nov 7, 2012 at 9:57 AM, Leutwyler, Markus > 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=3Dincubator-cordova-js.git;a > > =3Db > > lob;f=3Dlib/common/plugin/network.js;h=3Dadaba5ae8b6ec825986712d8b99e66= 0 > > 10 > > 5e56ae9;hb=3DHEAD > > > > The way we have it setup is the native side sends the JS side an=20 > > update whenever the network connection changes. If the type =3D=3D 'non= e' > > 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 > > wrote: > > > > > I was actually looking for a code example (in cordova-js) of a=20 > > > platform that sends out those events (because I'm investigating=20 > > > 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#on > > > li > > > ne > > > http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#of > > > fl > > > in > > > e > > > > > > Simon Mac Donald > > > http://hi.im/simonmacdonald > > > > > > > > > On Wed, Nov 7, 2012 at 9:36 AM, Leutwyler, Markus > > > wrote: > > > > > > > Is there a platform that sends out online/offline event to the=20 > > > > document when the connection status changes? I didn't find any=20 > > > > examples > > > > > > > > Thanks > > > > > > > > Markus > > > > > > > > > >